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:

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

and:

<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>.

Without reference to a schema that explicitly defines the children of <things> 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:

  <ol>
    <li>First item</li>
    <li>Second item</li>
    <li>Third item</li>
  </ol>

--
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

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to