Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28069 > unrolled thread

Cut out XML subtree

Started byFlorian Lindner <mailinglists@xgm.de>
First post2012-08-29 18:17 +0200
Last post2012-08-29 18:17 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Cut out XML subtree Florian Lindner <mailinglists@xgm.de> - 2012-08-29 18:17 +0200

#28069 — Cut out XML subtree

FromFlorian Lindner <mailinglists@xgm.de>
Date2012-08-29 18:17 +0200
SubjectCut out XML subtree
Message-ID<mailman.3940.1346257051.4697.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web