javaxmlstax

XMLStreamWriter remove prolog


I'm writing an xml using XMLStreamWriter. But I do not need the prolog.

<?xml version="1.0" ?>

How can I omit this line in my output xml.


Solution

  • XMLStreamWriter outputs the XML declaration when you call writeStartDocument().

    So you can simply skip this call if you don't want to include a XML declaration.