In XML, is order important?

xml

Solution

Order of elements is significant in XML, so in your example the two documents are different. Attribute order is not significant, though.

<people>
  <person name="kathy" id="1"/>
</people>

This is exactly the same as:

<people>
  <person id="1" name="kathy"/>
</people>

Problem

Is the order that elements of a common parent appear in XML a meaningful piece of data captured by the XML document, or is order not specified as being meaningful? For example, consider the two XML documents: ``` <people> <person name="sam"/> <person name="juni"/> </people> ``` and ``` <people> <person name="juni"/> <person name="sam"/> </people> ``` Are these documents considered to represent identical data, or is the difference in order captured?

Original source