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"?>
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"?>
If you make document dependent on
DOCTYPE
(e.g. use named entities) then it will stop being standalone, thusstandalone="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 horrible regex soup.
This worked for me with JDK1.7. standalone=\"no\" can be removed to get only rest of the xml part
If you are using only the default javax.xml package, you could set the JAXB_FRAGMENT option of the marshaller to 'true' (this omits the default xml processing instruction) and use the writeProcessingInstruction method of the XMLStreamWriter to insert your own: