Reputation: 181
I found
"Order of Attributes" The order of attributes in an XML instance is not preserved. When you query the XML instance stored in the xml type column, the order of attributes in the resulting XML may be different from the original XML instance."
from a link https://msdn.microsoft.com/en-us/library/bb510442.aspx
Q1) does that mean elements like following will not have any order that means I may get xyz1 then xyz. Or it will be ordered?
xyz
xyz1
Upvotes: 2
Views: 43
Reputation: 111491
XML elements are ordered; XML attributes are not. So, for this XML,
<root>
<element1 attribute1="value1" attribute2="value2">element1 value</element>
<element2 attribute3="value3" attribute4="value4">element2 value</element>
</root>
the elements, element1
and element2
have significant ordering, and attributes attribute1
through attribute4
have insignificant ordering.
See also XML attribute vs XML element.
Upvotes: 1
Reputation: 9143
As stated in https://www.w3.org/TR/xml-infoset/#infoitem.document order of elements is part of XML infoset. All libraries should preserve order. Notice that:
[children] An ordered list of child information items, in document order.
and
[attributes] An unordered set of attribute information items ...
Ordered list <> unordered set.
Upvotes: 1