Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Cut out XML subtree

Reply
Thread Tools

Cut out XML subtree

 
 
Florian Lindner
Guest
Posts: n/a
 
      08-29-2012
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Cut out XML subtree Andreas Perstinger Python 0 08-29-2012 05:31 PM
childNode(true) and subtree anupamjain@gmail.com Java 2 04-17-2006 03:08 AM
IETreeView - double click opens subtree =?Utf-8?B?ZGhucml2ZXJzaWRl?= ASP .Net 0 05-20-2005 09:09 AM
How to get an xml subtree using DOM using xerces? Anthony Mak XML 1 02-10-2005 09:11 AM
TreeView2 point to subtree of TreeView1? .pd. ASP .Net 1 09-01-2003 05:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57