Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #88779
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'deployed': 0.07; 'attributes': 0.09; "client's": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Help': 0.11; '2.7': 0.14; ':-(': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'say)': 0.16; 'wrote:': 0.18; 'machine': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'skip:" 40': 0.26; 'header:X-Complaints-To:1': 0.27; 'work.': 0.31; 'that.': 0.31; 'larry': 0.31; 'skip:r 60': 0.31; 'running': 0.33; 'subject:with': 0.35; 'but': 0.35; 'add': 0.35; '2.6': 0.36; 'searching': 0.37; 'project': 0.37; 'to:addr:python- list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'upgrade,': 0.84; 'dirty': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: Help with ElementTree |
| Date | Fri, 10 Apr 2015 14:02:20 +0200 |
| Organization | None |
| References | <CACwCsY4-3_7RBtx2LTLZ6pEAk-qW31XxeZz4aFVCmyK6f4Tong@mail.gmail.com> <mg6h07$uh$1@ger.gmane.org> <CACwCsY63BwubfhmNydzsu8Pg5qSKt6MJ_-N44hh0+yBSmZM7Sg@mail.gmail.com> <CACwCsY5vfpqGnYyCLi-7UVGNTm5VZbGddDPpW6UX+=cygUfUng@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p57bd96a7.dip0.t-ipconnect.de |
| User-Agent | KNode/4.13.3 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.204.1428667359.12925.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1428667359 news.xs4all.nl 2885 [2001:888:2000:d::a6]:49250 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:88779 |
Show key headers only | View raw
Larry Martell wrote:
> root.find("Doc/Node[@Name='SystemConfig']/Node[@Name='Environment']/"
> "Parameter[@Name='ToolName']/Value/Current").text
> So I tested this on a machine running 2.7, but then when I deployed it
> to my client's machine it did not work. Turns out they're running 2.6
> which I find does not support searching for attributes using the
> [@attribute] syntax. They do not want to upgrade, so I have to find a
> way to do this without using that. :-(
A quick and dirty approach (untested!):
Add the ElementPath.py from 2.7 to your project (as myelementpath.py, say)
and monkey-patch ElementTree:
import xml.etree.ElementTree
import myelementpath
xml.etree.ElementTree.ElementPath = myelementpath
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Help with ElementTree Peter Otten <__peter__@web.de> - 2015-04-10 14:02 +0200
csiph-web