This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XML library that can 'prettify' XML? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML library that can Watch "XML library that can New topic

XML library that can 'prettify' XML?

Martijn Verburg

Joined: Jun 24, 2003
Posts: 3274

Hi all,

I'm looking for a Java/XML lib that can take an XML string and turn it into a nicely indented XML string, e.g.

I'll be doing a Google search naturally, but thought I might as well post here since I work here and all that

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Sean Clark

Joined: Jul 15, 2009
Posts: 377


The java w3c libraries can do that job, I have used them for outputting simple snippets of HTML.
There was a good tutorial on it, one of the first results on google.


I love this place!
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41034
The Xerces library has some pretty-fying serializers in the org.apache.xml.serialize package.

Ping & DNS - my free Android networking tools app
It is sorta covered in the JavaRanch Style Guide.
subject: XML library that can 'prettify' XML?
Similar Threads
Castor: Mapping Element not included in Java Class
Adding html tags to script
Nested Map
backslash n is being escaped against my will
How do you compare a string using this...