Answers for "XmlRootElement Object to String"

0

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();
Posted by: Guest on April-19-2021

Code answers related to "XmlRootElement Object to String"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language