I try to serialize some config classes to xml config files using the XMLMapper. but I have some trouble with the attribute generation. Actually the generated XML is perfect, but XMLMapper adds sometimes a prefix to my attribute names.
e.g.
<Config zdef-2031720317:value="0">
instead of
<Config value="0">
This is really bad because i can't process the xml Structure afterwards with XOM anymore :(
Where is this effect coming from? I found already the fact that the xml generator seems to auto fix the namespace to make the attributes unique. Why is this necessary and how can i avoid it?
For those who are looking for a non woodstox answer. This did the trick for me:
xmlMapper.getFactory().getXMLOutputFactory().setProperty("javax.xml.stream.isRepairingNamespaces", false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With