Creating subtree from tree which is represented in xml - python

Posted by Jay on Stack Overflow See other posts from Stack Overflow or by Jay
Published on 2010-03-10T04:12:28Z Indexed on 2010/05/14 7:04 UTC
Read the original article Hit count: 187

Filed under:
|
|
|
|

Hi

I have an XML (in the form of tree), I require to create sub-tree out of it.

For ex:

<a>
  <b>
    <c>Hello</c>
  <d>
    <e>Hi</e>
</a>

Subtree would be

<root>
<a>
  <b>
    <c>Hello</c>
   </b>
</a>
<a>
  <d>
     <e>Hi</e>
  </d>
</a>
</root>

What is the best XML library in python to do it? Any algorithm that already does this would also be helpful. Note: the XML doc won't be that big, it will easily fit in memory.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about parsing