|
If I do something like this
XElement root = new XElement("Root",
new XAttribute("Att1", "a"),
new XAttribute("Att2", "b"),
new XAttribute("Att3", "c"));
XDocument document = new XDocument(root);
document.Save("file.xml");
Instead of it writing
Root Att1="a" Att2="b" Att3="c"/
it writes Root Att3="c" Att2="b" Att1="a"/
Even in debugging mode when I look at the XML contents of document it appears to be in the proper order, but when it writes to file it reverses them. Can anyone tell me why it is doing this?
|
|
|
|
|
Efficiency, I guess. Does the order matter?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Considering XML doesn't give a rats ass about the order of attributes, what's the problem?
|
|
|
|
|
Nukeman33 wrote: Can anyone tell me why it is doing this?
You have a bug either in implementation and/or requirements if you think that the order matters.
|
|
|
|
|
The logic behind writing to the file may be the culprit.
I guess if the order is not important to you, just ignore it!
|
|
|
|