public void marshal(T object, boolean formatted, OutputStream outputStream) throws XMLStreamException, JAXBException, TransformerException, JSONException { Configuration writeConfig = new Configuration(xmlNamespaceToJsonPrefix); MappedXMLOutputFactory xof = new MappedXMLOutputFactory(writeConfig); XMLStreamWriter xmlStreamWriter = xof.createXMLStreamWriter(outputStream); JaxbHelper jaxbHelper = JaxbHelper.get(clazz); jaxbHelper.marshal(object, formatted, xmlStreamWriter); }
public static XMLStreamWriter buildStreamWriter(Writer writer, Configuration configuration) throws XMLStreamException { MappedXMLOutputFactory xof = new MappedXMLOutputFactory(configuration); XMLStreamWriter xmlStreamWriter = xof.createXMLStreamWriter(writer); return xmlStreamWriter; }