Format XML with JAXB during unmarshal
Posted
by Tobiask
on Stack Overflow
See other posts from Stack Overflow
or by Tobiask
Published on 2009-07-02T12:28:40Z
Indexed on
2010/04/10
1:53 UTC
Read the original article
Hit count: 454
Hi there,
I want to format a XML document during unmarshal with JAXB. Unmarshal looks like:
Unmarshaller u = createAndsetUpUnmarshaller(enableValidation, evtHandler, clazz);
return u.unmarshal(new ByteArrayInputStream(stringSource.getBytes()));
While marshaling one can format the code via:
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
But this isn´t possible for the unmarchal process... Any idea how I can format the XML string with JAXB during (or after) unmarshal process?
BTW: I read some posts here about pretty print, but I want to do it with JAXB!
© Stack Overflow or respective owner