I'm writing data to xml files using com.sun.xml.txw2.output.IndentingXMLStreamWriter:
OutputStream os = new FileOutputStream(pOutputFile); XMLOutputFactory xmlof = XMLOutputFactory.newInstance(); XMLStreamWriter xsw = new IndentingXMLStreamWriter(xmlof.createXMLStreamWriter(os)); marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.setProperty(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, translationXsdFile.getName()); marshaller.setSchema(schema); marshaller.marshal(xmlObject, xsw); xsw.close();
Unforunately, this result in quotes " being encodes as:
& quot; (space added to show the entity here)
I would like to have it encoded as
& #34; (space added to show the entity here)
in xml outputfile without parsing it again/replacing the occurence of
& quot; (space added to show the entity here)