Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:text': 0.04; 'schema': 0.05; 'sufficient': 0.05; 'xml,': 0.05; 'data:': 0.07; 'defines': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'semantics': 0.09; 'specifying': 0.09; 'subject:keys': 0.09; 'underlying': 0.09; 'ignore': 0.14; 'applies': 0.15; 'explicitly': 0.15; 'attributes,': 0.16; 'constructs': 0.16; 'csv': 0.16; "didn't,": 0.16; 'different,': 0.16; 'formats.': 0.16; 'kern': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject: \n ': 0.16; 'subject:CSV': 0.16; 'subject:XML': 0.16; 'subject:headers': 0.16; 'subject:values': 0.16; 'unordered': 0.16; 'unordered,': 0.16; 'wrote:': 0.16; 'string': 0.17; 'attribute': 0.18; 'element': 0.18; 'stefan': 0.18; '(in': 0.18; '>>>': 0.20; 'trying': 0.22; 'assign': 0.22; 'interpret': 0.22; 'subject:will': 0.22; 'defined': 0.23; '2015': 0.23; 'elements': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.24; 'second': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints- To:1': 0.26; 'define': 0.27; 'xml': 0.27; '+0200,': 0.27; 'sequence': 0.27; "doesn't": 0.28; 'document,': 0.29; 'subject:that': 0.29; 'subject:) ': 0.32; 'point': 0.33; 'third': 0.33; 'hell': 0.33; 'ordered': 0.33; 'true.': 0.33; 'changing': 0.34; 'to:addr:python-list': 0.35; 'attempt': 0.35; 'formats': 0.35; 'robert': 0.35; 'but': 0.36; 'url:org': 0.36; 'list,': 0.36; 'there': 0.36; 'data.': 0.36; 'subject:" ': 0.36; 'two': 0.37; 'subject:: ': 0.37; 'item': 0.38; 'received:org': 0.38; 'is,': 0.38; 'mean': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'data': 0.40; 'subject:with': 0.40; 'subject: (': 0.40; 'information': 0.62; 'different': 0.64; 'world': 0.64; 'our': 0.64; 'believe': 0.67; 'choose': 0.68; 'obvious': 0.72; 'denis': 0.84; 'eco': 0.84; 'fragments': 0.84; 'hand.': 0.84; 'ordered.': 0.84; 'subject:write': 0.84; 'terrible': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robert Kern Subject: Re: enumerate XML tags (keys that will become headers) along with text (values) and write to CSV in one row (as opposed to "stacked" values with one header) Date: Mon, 29 Jun 2015 14:04:45 +0100 References: <14aeae7a-41ab-4619-8331-7995e2420e54@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: uk.enthought.com User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 67 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1435583102 news.xs4all.nl 2912 [2001:888:2000:d::a6]:47142 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 6439 X-Received-Body-CRC: 3236429974 Xref: csiph.com comp.lang.python:93288 On 2015-06-28 22:00, Denis McMahon wrote: > On Sun, 28 Jun 2015 09:46:36 +0200, Stefan Behnel wrote: > >> Denis McMahon schrieb am 26.06.2015 um 09:44: >>> xml data is an unordered list, and are trying to assign an order to it. >>> >>> If the xml data was ordered, either each tag would be different, or >>> each tag would have an attribute specifying a sequence number. >> >> XML is not unordered. The document order is well defined and entirely >> obvious from the data. Whether this order is relevant and has a meaning >> or not is, however, not part of XML itself but is left to the semantics >> of the specific document format at hand. Meaning, XML document formats >> can choose to ignore that order and define it as irrelevant. That >> doesn't mean it's not there for a given document, but it may mean that a >> re-transmission of the same document would be allowed to use a different >> order without changing the information. >> >> This property applies to pretty much all structured data formats and not >> just XML, by the way, also to CSV and other tabular formats. > > The point I am trying to make to OP is that the following two XML > fragments define the same data: > > > string 1 > string 2 > string 3 > > > and: > > > string 3 > string 2 > string 1 > > > Each is just a member of the collection things, the xml does not > contain sufficient information to state that is an ordered > collection containing a specific sequence of . Without reference to a schema that explicitly defines the children of to be unordered, this is not true. The XML Information Set defines the children of all elements to be an ordered set (in contrast to attributes, which are unordered). A particular XML schema may choose to consider the order of children of a particular element to be irrelevant, but XML itself keeps them ordered. http://www.w3.org/TR/xml-infoset/#infoitem.element If it didn't, then XHTML would have a hell of a time with ordered constructs like this:
  1. First item
  2. Second item
  3. Third item
-- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco