XML attribute ordering of namespaces

A related question to one I asked earlier...

Just checking on something: Should the order of the xmlns, xmlns:xsi and xsi:schemaLocation attributes in an XML file matter?

I'm finding that it does - at least when using XML Notepad 2007 to view the XML file. For example (assuming that my XML file is legal according to my schema) this gives no errors (Example 1):

    xsi:schemaLocation="http://www.someurl.com/ns/myroot http://www.someurl.com/xml/schemas/myschema.xsd">



but this one does (Example 2):

    xsi:schemaLocation="http://www.someurl.com/ns/myroot http://www.someurl.com/xml/schemas/myschema.xsd"



(the error being that 'sometag' is an illegal entry according to the schema).

My problem is that if I use the code from my other question to generate my namespace and schema attributes then I get the XML attributes output in the Example 2 order...

Does the xmlns attribute always have to be first in the attribute list?


Ah - I've spotted my problem....

The XML I'm actually working on is fiendishly complicated and I hadn't noticed that I'd inserted an xmlns="" in all my child nodes. Once I remove that the problem goes away and the ordering of namespace attributes makes no difference - which is what I expected...

Need Your Help

How to create 2 different ROOT loggers with logback?

logging root logback slf4j

I'm happily using SLF4J with logback and use 2 appenders for the ROOT logger.