Getting Marshall result into String

You can do it like this :

CreateExemptionCertificate cc = ...;
JAXBContext context = JAXBContext.newInstance(CreateExemptionCertificate.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);

StringWriter sw = new StringWriter();
m.marshal(cc, sw);

String result = sw.toString();

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)