use of javax.xml.stream.XMLOutputFactory 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);
}
}
use of javax.xml.stream.XMLOutputFactory in project CFLint by cflint.
the class DefaultCFlintResultMarshaller method output.
@Override
public void output(BugList bugList, Writer writer, boolean showStats) throws MarshallerException {
try {
final XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
XMLStreamWriter xtw = new IndentingXMLStreamWriter(xmlOutputFactory.createXMLStreamWriter(writer));
writeIssues(bugList, xtw, showStats);
xtw.flush();
} catch (XMLStreamException e) {
throw new MarshallerException(e);
}
}
Aggregations