Remove 'standalone="yes"' from generated XML
This property:
marshaller.setProperty("com.sun.xml.bind.xmlDeclaration", false);
...can be used to have no:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
However, I wouldn't consider this best practice.
You can either use
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
or
marshaller.setProperty("com.sun.xml.bind.xmlDeclaration", false)
to disable the default XML declaration, and then add your custom XML declaration,
<?xml version="1.0" encoding="UTF-8"?>
by
marshaller.setProperty("com.sun.xml.bind.xmlHeaders",
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
to the generated xml, thus avoiding the standalone="yes" property.
in JAXB that is part of JDK1.6
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);