Last active
May 27, 2020 13:34
-
-
Save edubriguenti/24a45d358f3b74961face87fbdcb4042 to your computer and use it in GitHub Desktop.
JAXB PARSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void toXml(UpdateRequest request) { | |
try { | |
JAXBContext jaxbContext = JAXBContext.newInstance(CreateResponse.class); | |
Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); | |
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); | |
StringWriter sw = new StringWriter(); | |
jaxbMarshaller.marshal(request, sw); | |
String xmlContent = sw.toString(); | |
System.out.println( xmlContent ); | |
System.out.println( ); | |
} catch (JAXBException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment