Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31359
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <tharanga.abeyseela@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'xml,': 0.05; 'snippet': 0.09; 'subject:using': 0.09; 'subject:xml': 0.09; 'advance': 0.10; 'element.': 0.16; 'guys,': 0.16; 'nodes': 0.16; 'subject:search': 0.16; 'string': 0.17; 'received:209.85.214.174': 0.21; 'elements': 0.23; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'node': 0.29; 'parent': 0.29; 'code': 0.31; 'point': 0.31; 'file': 0.32; 'problem': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'xml': 0.37; 'received:209': 0.37; 'delete': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'remove': 0.61; 'different': 0.63; 'names..': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=dmv8Bb4/tc8DgoJIOyGmRe/nY8zf7f3BnZfvgLXpKGM=; b=T9cOZXqXJEsZGhlBCPzsomuI40tBtiCvK4F26ty/ZGXcHr64UxmSRZGeyubSPu9FnL WpyAjzKPb+ZwgIUIbSqW2kJVxTNBsaPA/uUHfe2IRcZunb2dqY4gJdclnFd9lNL6BuHH XUHSsiCTU1UMEiukOT+xMer7zGos8eQi9FQWWvuAyMB3MXpFPi4CTc27olgDpUKmnZ/R BpX6YODnlVfzv2eAEuOA1U2H7hqZV/hfxIT2ircNh6zlbePtIIhXgDjQkw18IrKmedZ4 4iVftmNhJ5Aq0N7jkIz0PbOaboKhkgJXUnzU050tY62pBkim1rOD5ZFPJSPRXK0I6EF8 b6hQ== |
| MIME-Version | 1.0 |
| Date | Tue, 16 Oct 2012 14:57:30 +1100 |
| Subject | delete xml elements - using xpath search |
| From | Tharanga Abeyseela <tharanga.abeyseela@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.2249.1350359858.27098.python-list@python.org> (permalink) |
| Lines | 40 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1350359858 news.xs4all.nl 6939 [2001:888:2000:d::a6]:46711 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31359 |
Show key headers only | View raw
Hi guys,
i need to delete the following pattern and its parent node from my xml
file (IF THE SEARCH STRING FOUND)
<Rating>NC</Rating>
if i find the above particular string , i need to delete the XML
elements (parent of the <Rating> element. problem is i have different
parent nodes with different names..
like
<movies>
<name> xxx</name>
<title>xxx </title>
<Rating>NC</Rating>
</movies>
<tvshow>
<name> </name>
<title>xxx </title>
<Rating>NC</Rating>
</tvshow>
<tvepisode>
<name>xxx </name>
<title>xxx </title>
<Rating>M</Rating>
</tvepisode>
as an example, i need to remove <movies> section and <tvshow> section
from my xml, (because it has the word NC) but need to keep <tvepisode>
can someone point me to the correct direction, or code snippet
Thanks in advance
tharanga
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
delete xml elements - using xpath search Tharanga Abeyseela <tharanga.abeyseela@gmail.com> - 2012-10-16 14:57 +1100
csiph-web