Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

XmlRootElement Object to String

JAXBContext context = JAXBContext.newInstance(Something.class);
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
StringWriter out = new StringWriter();
marshaller.marshal(something, out);
String xml = out.toString();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #XmlRootElement #Object #String
ADD COMMENT
Topic
Name
1+3 =