The JAXB objects have been generated with Eclipse and then I’ve been trying to tweak it.
I want to get this with JAXB:
</RootElement xmlns="http://example.com/rootElement">
<Body>
<OtherRoot xmlns="http://example.com/OtherRoot">
<CompanyName>Google</CompanyName>
<DataSet>online</DataSet>
</OtherRoot>
</Body>
</RootElement>
but all I’ve managed to do is this:
</RootElement xmlns="http://example.com/rootElement"
xmlns:n2="http://example.com/OtherRoot">
<Body>
<ns2:OtherRoot>
<ns2:CompanyName>Goolge</ns2:CompanyName>
<n2:DataSet>online</n2:DataSet>
</ns2:OtherRoot>
</Body>
</RootElement>
Which is not ideal. What would be the best way to get the desired result?
Thanks to Blaise for mention his previous answer. I ended using a similar approach:
This is how I intercepted the Writer:
And here is the XMLWriter class: