This is a Java library to format XML using regex. Library is inspired from xmlfmt.
Originally developed for RESTClient, where we wanted formatting support without modifying XML content.
import org.wiztools.jxmlfmt.XMLFmt;
...
String formatted = XMLFmt.fmt("<root><this><is>a</is><test /><message><org><cn>Some org-or-other</cn><ph>Wouldnt you like to know</ph></org><contact><fn>Pat</fn><ln>Califia</ln></contact></message></this></root>");
Result would be:
<root>
<this>
<is>
a
</is>
<test />
<message>
<org>
<cn>
Some org-or-other
</cn>
<ph>
Wouldnt you like to know
</ph>
</org>
<contact>
<fn>
Pat
</fn>
<ln>
Califia
</ln>
</contact>
</message>
</this>
</root>