xml - is it important the order of the namespace in the root? is possible to order them? -
i have original xml has following struct:
<root xmlns="http://xyz.com/2006/root" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xyz.com/2006/root.xsd">
to create new xml, use code:
xnamespace ns = "http://xyz.com/2006/root"; xnamespace xsins = "http://www.w3.org/2001/xmlschema-instance"; xdocument doc = new xdocument( new xdeclaration("1.0", "utf-8", null), new xelement(ns + "root", new xattribute(xnamespace.xmlns + "xsi", xsins), new xattribute(xsins + "schemalocation", "http://xyz.com/2006/root.xsd"), ));
the result is:
<root xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xyz.com/2006/root.xsd" xmlns="http://xyz.com/2006/root">
how can see, in original xmls first attribute, xmls:xsi second , xsi:schemalocation last one. in new xml order different.
i know if order impotant or not.
however, learn more xml, know if there way order attributes.
thanks.
the order of attributes (including namespace declaration attributes) in xml has no significance. xml processing tools not required retain original order.
Comments
Post a Comment