Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XMLWriter extends attribute name with zdef?

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?

like image 801
Divine Avatar asked Dec 09 '22 17:12

Divine


1 Answers

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);
like image 164
user1553865 Avatar answered Jan 07 '23 23:01

user1553865