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


Groups > comp.lang.python > #28069

Cut out XML subtree

From Florian Lindner <mailinglists@xgm.de>
Subject Cut out XML subtree
Date 2012-08-29 18:17 +0200
Newsgroups comp.lang.python
Message-ID <mailman.3940.1346257051.4697.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web