I want to be able to specify the order of the attributes.
Take the below code.
XmlDocument doc = new XmlDocument();
XmlElement element = doc.CreateElement("Test");
XmlElement subelement = doc.CreateElement("SubTest");
XmlAttribute att1 = doc.CreateAttribute("Value1");
XmlAttribute att2 = doc.CreateAttribute("Value2");
subelement.Attributes.Append(att1);
subelement.Attributes.Append(att2);
element.AppendChild(subelement);
doc.AppendChild(element);
doc.Save("C:\\Test.xml");
Creates this:
<Test>
<SubTest Value1="" Value2="" />
</Test>
Is there some way for me to dictate that Value2 is always first and Value1 is always second apart from the order they are added to the XmlDocument?
I know this doesnt matter when is comes to a valid XML document, but i would like to accomplish this for ease of reading by a human.