Hello everyone. Does anybody know of an API to format XML strings?
I have lots of data in xml to debug, and having them all in a single line makes things very hard to understand. It would be great if I could just wirte something like: String formattedXml = XMLFormatter.format( xmlString ) ;
I'm starting my search, but I've found only thing for the .NET platform.
posted 11 years ago
See HowToPrettyPrintXmlWithJava for doing the job with Xerces' XMLSerializer (requires Xerces), or DocumentToString for doing it with an "identity transform" (uglier formatting, but doesn't require third party libraries if you're using J2SE 1.4).