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


Groups > comp.lang.python > #93304

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)

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.python
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 2015-06-30 00:54 +0000
Organization A noiseless patient Spider
Message-ID <mmspbt$88c$1@dont-email.me> (permalink)
References <14aeae7a-41ab-4619-8331-7995e2420e54@googlegroups.com> <mmivtd$fqa$1@dont-email.me> <mailman.150.1435477605.3674.python-list@python.org> <mmpn9p$667$1@dont-email.me> <8e7d3dd8-f7c1-4466-ae82-f25e4a252fc7@googlegroups.com>

Show all headers | View raw


On Sun, 28 Jun 2015 17:07:00 -0700, Ned Batchelder wrote:

> On Sunday, June 28, 2015 at 5:02:19 PM UTC-4, Denis McMahon wrote:

>> <things>
>>   <thing>string 3</thing>
>>   <thing>string 2</thing>
>>   <thing>string 1</thing>
>> </things>

>> Each <thing> is just a member of the collection things, the xml does
>> not contain sufficient information to state that <things> is an ordered
>> collection containing a specific sequence of <thing>.
> 
> You are right that XML does not specify that <things> is an ordered
> collection.
> But XML does preserve the order of the children.  There are many XML
> schema that rely on XML's order-preserving nature.

But what we *don't* know is whether the order of the umpteen identical 
tags in the XML has any significance in terms of the original data, 
although the OP seems intent on assigning some significance to that order 
without any basis for doing so.

Consider the following tuple:

t = (tuplemember_1, tuplemember_2, .... tuplemember_n)

Can we safely assume that if the tuple is ever converted to xml, either 
now or at some future date using whatever the code implementation is 
then, that the order of the items will be preserved:

<tuple>
  <item>tuplemember_1</item>
  <item>tuplemember_2</item>
....
  <item>tuplemember_n/item>
</tuple>

And if we're reading that xml structure at some point in the future, is 
it safe to assume that the tuple members are in the same order in the xml 
as they were in the original tuple?

For sanity <item> should have an attribute specifying the sequence of the 
item in it's tuple.
-- 
Denis McMahon, denismfmcmahon@gmail.com

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


Thread

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) kbtyo <ahlusar.ahluwalia@gmail.com> - 2015-06-25 11:39 -0700
  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) Denis McMahon <denismfmcmahon@gmail.com> - 2015-06-26 07:44 +0000
    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) Stefan Behnel <stefan_ml@behnel.de> - 2015-06-28 09:46 +0200
      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) Denis McMahon <denismfmcmahon@gmail.com> - 2015-06-28 21:00 +0000
        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) Ned Batchelder <ned@nedbatchelder.com> - 2015-06-28 17:07 -0700
          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) Denis McMahon <denismfmcmahon@gmail.com> - 2015-06-30 00:54 +0000
            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) Robert Kern <robert.kern@gmail.com> - 2015-06-30 10:16 +0100
              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) Marko Rauhamaa <marko@pacujo.net> - 2015-06-30 19:32 +0300
        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) Robert Kern <robert.kern@gmail.com> - 2015-06-29 14:04 +0100
      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) Sahlusar <sahluwalia@wynyardgroup.com> - 2015-06-29 07:52 -0700
        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) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-06-29 21:26 -0400
        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) Chris Angelico <rosuav@gmail.com> - 2015-06-30 22:40 +1000

csiph-web