use of com.sun.xml.txw2.output.IndentingXMLStreamWriter in project jqa-core-framework by buschmais.
the class RuleSetWriterImpl method marshal.
private void marshal(Writer writer, JqassistantRules rules) {
XMLOutputFactory xof = XMLOutputFactory.newInstance();
XMLStreamWriter streamWriter = null;
try {
streamWriter = xof.createXMLStreamWriter(writer);
} catch (XMLStreamException e) {
e.printStackTrace();
}
XMLStreamWriter indentingStreamWriter = new IndentingXMLStreamWriter(new CDataXMLStreamWriter(streamWriter));
try {
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
marshaller.marshal(rules, indentingStreamWriter);
} catch (JAXBException e) {
throw new IllegalArgumentException("Cannot write rules to " + writer, e);
}
}
Aggregations