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


Groups > comp.lang.python > #28069

Cut out XML subtree

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <mailinglists@xgm.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.031
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'parsers': 0.09; 'received:138': 0.09; 'received:localnet': 0.09; 'yet.': 0.13; '(rather': 0.16; 'choosen': 0.16; 'node,': 0.16; 'subject:XML': 0.16; 'thanks,': 0.18; 'memory': 0.18; 'received:mail- bk0-f46.google.com': 0.22; 'header:User-Agent:1': 0.26; 'document.': 0.27; 'received:209.85.214.46': 0.27; 'small,': 0.27; 'consumption': 0.29; 'parent': 0.29; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'charset:us-ascii': 0.36; 'xml': 0.37; 'received:209': 0.37; 'planning': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'hello,': 0.39; 'application': 0.40; 'header:Received:5': 0.40; 'first': 0.61; 'cut': 0.71; 'florian': 0.84; 'subject:Cut': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=xgm.de; s=google; h=from:to:subject:date:message-id:user-agent:mime-version :content-transfer-encoding:content-type; bh=fFaKeg6DnTAiDLaTE0D6MaBp7kXqhUVH2FyMDvlaoLc=; b=jiE149bI0OXSqYKopUTv/5hm4Snrgf3XbFdJuaSy7EAJJdSkuP+NGu60VnJtkzSFAG V18tZI+OvNZxFMUM1Lni877UlXPJ4OQopnr3sunpA0ef078M8xnHCSmMtrdjIpGEbXtm Qh5CA34GRD9ZmHpeArksEuv7ndQ14LlG5N98U=
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-transfer-encoding:content-type:x-gm-message-state; bh=fFaKeg6DnTAiDLaTE0D6MaBp7kXqhUVH2FyMDvlaoLc=; b=owLlxo1XgmlV64j7t6gOYp/x0Fm3KXZcWNVfIQgtU2lIakxT6UtaUvlJ/bYQSVdgtO YCbeSzxGsFGHiOwQzvJk/7wXQSuUjhmGzVpK0o/PuVnnHkvvSdm5/wYYTflKuBa8072K OcOGmZf/kTPFqNTJOAyoXNOebc1TZ4KB307KYn2/E8c7TdnQJXg/Cy1uqjYw6QCT10eP j4zhEzL/42iEyY3jGbW9LsvJdvgLeVe+PknOauQt36bzmObbNibUEwnL1YRRDCTwPVQt PpqjMpSOiZlLE8N0M1RGVqaYlPXMgHoRTk/GkvrCVdbnbtPB0Ljcd92lYh+m6L1BNO/1 H/Xw==
From Florian Lindner <mailinglists@xgm.de>
To python-list@python.org
Subject Cut out XML subtree
Date Wed, 29 Aug 2012 18:17:18 +0200
User-Agent KMail/4.9 (Linux/3.5.3-1-ARCH; KDE/4.9.0; x86_64; ; )
MIME-Version 1.0
Content-Transfer-Encoding 7Bit
Content-Type text/plain; charset="us-ascii"
X-Gm-Message-State ALoCoQn3LGYvDX1ArQVs8Jt9D9aC+Sc1q7W10SghLULJyuOOi/14MM2gI6oh96m0ORKqaP84cvXx
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3940.1346257051.4697.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346257051 news.xs4all.nl 6841 [2001:888:2000:d::a6]:36236
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28069

Show key headers only | 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