I'm currently using XMLStreamWriter to parse together an XML document. The only parameters that I'm allowed to pass in are "encoding" and "version", but I would like to have "standalone=no" in the declaration, as well. Here's what my output currently looks like:
<?xml version='1.0' encoding='UTF-8'?>
How can I make something like this?
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
XmlStreamWriter
is an interface: it has more than one implementation!If you install Saxon (any edition), you can create a Serializer using any of the serialization parameters defined in XSLT (for example standalone=yes), and then you can get an
XmlStreamWriter
that writes to thisSerializer
usingSerializer.getXmlStreamWriter()
: