I have a xml input stream that contains all tags in one line, eg <xml><MyRequest><someProperty attribute="test"/></MyRequest></xml>
Question: how can I best output this pretty printed?
Using jackson
and woodstox
, it would be as follows if I had a simple java bean object:
ObjectMapper xmlMapper = new XmlMapper();
String xml = xmlMapper.writeValueAsString(new MyRequest());
But I don't have any java bean and don't want to create one. Just pretty print the given xml without transformation to any bean.
How could I best achieve this, with regards to performance?
This can be done by setting this property: