title: JAXBContext and Marshaller change the order of XML namespace
body: <p>I have a code line like this : </p>
  
  <pre><code>StringWriter writer = new StringWriter(); 
  JAXBContext jc = JAXBContext.newInstance(namespace);
  Marshaller marshaller = jc.createMarshaller();        
  marshaller.marshal(input, writer);
  </code></pre>
  
  <p>When <code>namespace = "nfpa:nfpares"</code>. I have a generated content like this : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;ServiceRequest xmlns:ns2="nfpares" xmlns="nfpa"&gt;
  ...
  &lt;/ServiceRequest&gt;
  </code></pre>
  
  <p>but somehow, in another part of the library (which I don't have control), the developer also use <code>JAXBContext</code> and the same namespace, yet the content generated is: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;ServiceRequest xmlns="nfpa" xmlns:ns2="nfpares"&gt;
  ...
  &lt;/ServiceRequest&gt;
  </code></pre>
  
  <p>Notice the namespace is still the same, but their ordering has been switched. I need to do an encrypted validation on the raw content. Everything is the same between these two, except for the order of namespace. Does anyone know what has happened? Because I use a different version of <code>JAXBContext</code>?  </p>
  
  <p>thanks</p>