Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'explicitly': 0.04; 'parser': 0.07; 'referring': 0.07; 'abstraction': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'semantics': 0.09; 'ignore': 0.13; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'occur.': 0.16; 'parser.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:XML': 0.16; 'subject:parser': 0.16; 'config': 0.17; 'element': 0.17; 'stefan': 0.17; '(or': 0.18; 'python?': 0.20; 'parse': 0.22; 'defined': 0.22; 'elements': 0.23; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; '(which': 0.26; 'question': 0.27; 'format,': 0.27; 'header:X-Complaints-To:1': 0.28; 'code': 0.31; '(and': 0.32; 'file': 0.32; 'received:84': 0.32; 'to:addr:python-list': 0.33; 'equal': 0.33; 'so,': 0.35; 'sometimes': 0.35; 'subject:?': 0.35; "won't": 0.35; 'received:org': 0.36; 'but': 0.36; 'totally': 0.36; 'xml': 0.37; 'does': 0.37; 'level': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'application': 0.40; 'where': 0.40; 'header:Received:5': 0.40; 'decision': 0.60; 'you.': 0.61; 'matter': 0.61; 'here:': 0.62; 'different': 0.63; 'more': 0.63; 'therefore': 0.65; 'florian': 0.84; 'received:arcor-ip.net': 0.84; 'received:pools.arcor-ip.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: XML parser: Element ordering? Date: Fri, 31 Aug 2012 14:21:54 +0200 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: dslb-084-056-031-208.pools.arcor-ip.net User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346415728 news.xs4all.nl 6848 [2001:888:2000:d::a6]:50556 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28170 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.: > > > > > > is not equal to: > > > > > > 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. Stefan