Cut out XML subtree

F

Florian Lindner

Hello,

I have a (rather small, memory consumption is not an issue) XML document. The
application is still at the planning stage, so none of the XML parsers from
the stdlib is choosen yet.

I want to cut out an XML subtree like that:

<root attribute=foobar>
<subA> <some_more_elements /> </subA>

<subB> <here_are_elements_too /></subB>
</root>

Now I want to get the subB note including parent node, but none of
sibliblings:

<root attribute=foobar>
<subB> <here_are_elements_too /></subB>
</root>

Is there a way I can do that using etree or DOM? The first is prefered...

Thanks,

Florian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top