File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring 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: 3275

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: 42959
The Xerces library has some pretty-fying serializers in the org.apache.xml.serialize package.
I agree. Here's the link:
subject: XML library that can 'prettify' XML?
It's not a secret anymore!