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


Groups > comp.lang.python > #28171

Re: XML parser: Element ordering?

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'explicitly': 0.04; 'attributes': 0.07; 'parser': 0.07; 'referring': 0.07; 'abstraction': 0.09; 'semantics': 0.09; 'cc:addr:python-list': 0.10; 'ignore': 0.13; 'element.': 0.16; 'occur.': 0.16; 'parser.': 0.16; 'subject:XML': 0.16; 'subject:parser': 0.16; 'wrote:': 0.17; 'config': 0.17; 'element': 0.17; 'stefan': 0.17; '(or': 0.18; 'python?': 0.20; 'parse': 0.22; 'defined': 0.22; 'cc:2**0': 0.23; 'elements': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; '(which': 0.26; 'am,': 0.27; 'question': 0.27; 'format,': 0.27; 'code': 0.31; '(and': 0.32; 'file': 0.32; 'equal': 0.33; 'so,': 0.35; 'sometimes': 0.35; 'subject:?': 0.35; "won't": 0.35; 'there': 0.35; 'but': 0.36; 'totally': 0.36; 'xml': 0.37; 'does': 0.37; 'level': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'received:192': 0.39; 'application': 0.40; 'where': 0.40; 'received:192.168': 0.40; 'decision': 0.60; 'you.': 0.61; 'matter': 0.61; 'here:': 0.62; 'different': 0.63; 'more': 0.63; 'within': 0.64; 'therefore': 0.65; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'florian': 0.84; 'received:74.208.4.194': 0.84
Date Fri, 31 Aug 2012 08:31:17 -0400
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
MIME-Version 1.0
To Stefan Behnel <stefan_ml@behnel.de>
Subject Re: XML parser: Element ordering?
References <CAJtBfr-+_pBMoLoaCDRyLKYiV8k4iftpx8PPqKtoMHJs+9spbw@mail.gmail.com> <k1qa92$ne0$1@ger.gmane.org>
In-Reply-To <k1qa92$ne0$1@ger.gmane.org>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:RX9M1UA53Uy7hP2kdnaE895UT6AwKmwRoSBUIVsdtFK JIRcD8weGeO7xSrXSTBEq2+xRnfplRZa55CqYOTw3gDPrzSV/U jSXaGb2x5tovqzu6R4L0Dj5L/Fr+ds4yNlb45S9aLQpORMRnBb rqnkZWIa0iMnbH1eyc8jDWRcrGCI0YAFkeLtTjnNsYAfF9J+Fs Z3DqFKssnDGPb7+cxBbe5VEWkYUKKf5IYaz/0WXLgtkCeAlFY7 KUJkekkSo9a+zzPP96EVgLv8lpmSYXsRf7MTR5NYZ/eOShuTGL WezYfeO9JviHSDM1zYQBoFzvivjULS+R4VD+wflRz4R2+fcXw= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To d@davea.name
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.4009.1346416310.4697.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346416310 news.xs4all.nl 6914 [2001:888:2000:d::a6]:53618
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28171

Show key headers only | View raw


On 08/31/2012 08:21 AM, Stefan Behnel wrote:
> Florian Lindner, 31.08.2012 14:03:
>> I plan to use the etree.ElementTree XML parser to parse a config file
>> in which the order of the elements matter, e.g.:
>>
>> <A>
>> <C /><D />
>> </A>
>>
>> is not equal to:
>>
>> <A>
>> <D /><C />
>> </A>
>>
>> I have found different answers to the question if order matters in XML
>> documents. So my question here: Does it matters (and is more or less
>> guarenteed to matter in the future) for the ElementTree parser of
>> python?
> It matters for XML documents, so, yes, any XML parser will definitely
> honour the document order (which is actually well defined for an XML document).
>
> What you might be referring to is the case of a specific XML document
> format, where the application (or sometimes specification) can explicitly
> state that the element order in a given subtree has no meaning for the
> semantics of the element and that therefore code must ignore the order in
> which elements occur. But that won't magically make the parser ignore it
> for you. That's a totally different level of abstraction and a deliberate
> decision of the code that *uses* the parser.
>
>
There is a place in xml documents which is defined to be unordered. 
That's the attributes within one element.

<E  attr3="x" attr1="y" attr2="z" />

is indistinguishable from:

<E  attr2="z" attr1="y" attr3="x" />

-- 

DaveA

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


Thread

Re: XML parser: Element ordering? Dave Angel <d@davea.name> - 2012-08-31 08:31 -0400

csiph-web