Hi people,
Do you know of a JAXB setting to prevent standalone="yes" from being generated in the resulting XML?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Hi people,
Do you know of a JAXB setting to prevent standalone="yes" from being generated in the resulting XML?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
marshaller.setProperty("com.sun.xml.bind.xmlDeclaration", Boolean.FALSE);
can be used to have no
"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
"
However i wouldnt consider this best practice.
If you make document dependent on DOCTYPE
(e.g. use named entities) then it will stop being standalone, thus standalone="yes"
won't be allowed in XML declaration.
However standalone XML can be used anywhere (while non-standalone is problematic for XML parsers that don't load externals).
I don't see how this declaration could be a problem, other than for interoperability with software that doesn't support XML, but some broken homegrown XML-like voodoo.