I have a code line like this :
StringWriter writer = new StringWriter();
JAXBContext jc = JAXBContext.newInstance(namespace);
Marshaller marshaller = jc.createMarshaller();
marshaller.marshal(input, writer);
When namespace = "nfpa:nfpares"
. I have a generated content like this :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceRequest xmlns:ns2="nfpares" xmlns="nfpa">
...
</ServiceRequest>
but somehow, in another part of the library (which I don't have control), the developer also use JAXBContext
and the same namespace, yet the content generated is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceRequest xmlns="nfpa" xmlns:ns2="nfpares">
...
</ServiceRequest>
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 JAXBContext
?
thanks