I have a Java String that contains XML, with no line feeds or indentations. I would like to turn it into a String with nicely formatted XML. How do I do this?
Underscore-java has static method U.formatXml(string). I am the maintainer of the project. Live example
import com.github.underscore.lodash.U;
public class MyClass {
public static void main(String args[]) {
String xml = "hello";
System.out.println(U.formatXml("" + xml + ""));
}
}