Format XML with JAXB during unmarshal

java, jaxb, pretty-print, xml

Solution

it is logically senseless to format the xml code while unmarshalling it?

Problem

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!

Original source