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!
javax.xml.bind.PropertyException: name: jaxb.formatted.output value: true
(METRO was used for the test). – Efrem