• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Attributes in Alphabetical Order

 
John Lark
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey All,

I am storing xml in SQL Server, and then putting it into a document to send across the interweb. One thing I noticed upon recieving this XML document is that the attributes are in alphabetical order. For the most part I understand that this is irrelavent. I would like to know however what is causing this. Is it SQL or org.w3c.dom. I see a lot of people online pointing at org.w3c.dom, but was wondering if thats a standerd feature or if it means somthing was done incorrectly? does org.w3c.dom always alphabitise XML attributes? Is it possible SQL did it? I need to be able to explain why its happinig even if I dont need to change it so that it dosent happen.
 
Paul Clapham
Sheriff
Pie
Posts: 20980
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Lark wrote:I need to be able to explain why its happinig.


No, you don't. The XML Recommendation (as it appears you already know) says the order of attributes is meaningless. Given that, there is no need to explain why any particular serializer outputs attributes in the order it outputs them. It suffices to say that they do what they do.

 
John Lark
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick response, so then I can say confidently this is simply what the org.w3c.dom does?
 
Paul Clapham
Sheriff
Pie
Posts: 20980
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Lark wrote:Thanks for the quick response, so then I can say confidently this is simply what the org.w3c.dom does?


Not really, no. Those classes store XML in a tree structure but as far as I know they don't serialize XML to a document. Look more closely at your code to see what's actually doing the serialization.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic