Marshaller marshaller = context.createMarshaller();
//marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
// Set up the JSON StAX implementation
XMLOutputFactory factory = new BadgerFishXMLOutputFactory();
XMLStreamWriter xsw = factory.createXMLStreamWriter(os);
marshaller.marshal(obj, xsw);
xsw.close();
} catch (JAXBException e) {
e.printStackTrace();