JAXB namespace ordering

Is it possible to control the order of namespaces in documents generated through JAXB? I know this does not apply to XML standards, but for some reason do we need to create namespace declarations in a specific order? For example, we have now created

<rootelement a="http://www.example.com/xom" b="http://www.example.com/crops"> .. </rootelement> 

But I need:

 <rootelement b="http://www.example.com/crops" a="http://www.example.com/xom"> .. </rootelement> 
+4
source share
1 answer

JAXB does not directly support this, but you can marshal your ContentHandler, XMLStreamWriter or XMLEventWriter object and make sure that the namespace and attribute order are there.

+6
source

All Articles