how to pretty print xml from Java
Posted
by Steve McLeod
on Stack Overflow
See other posts from Stack Overflow
or by Steve McLeod
Published on 2008-09-26T12:21:11Z
Indexed on
2010/04/08
10:33 UTC
Read the original article
Hit count: 566
I have a Java String that contains XML, with no line feeds and indentations. I would like to turn in into a String with nicely formatted XML. How do I do this?
String unformattedXml = "<tag><nested>hello</nested></tag>";
String formattedXml = new [UnknownClass]().format(unformattedXml);
Note: My input is a String. My output is a String.
© Stack Overflow or respective owner