XML pretty printer

jmm-list-gn

Usenet Archive
Joined
Jul 29, 2004
Messages
30
Reaction score
0
Hello,
Most XML examples have the content neatly laid out with newlines and indenting. A DOM parser, however, does not bother with such niceties when creating an XML file. Is there a "pretty printer" function somewhere that makes XML easier to read by adding the indenting?
 

Patrick TJ McPhee

Usenet Archive
Joined
Apr 2, 2000
Messages
269
Reaction score
0
% Is there a "pretty printer" function somewhere that makes XML easier to % read by adding the indenting?

xmllint from the libxml distribution has a --format option which might do what you want. http://xmlsoft.org
 

Johnny Kent

Usenet Archive
Joined
Jul 20, 2004
Messages
6
Reaction score
0
jmm-list-gn said:
Hello,
Most XML examples have the content neatly laid out with newlines and indenting. A DOM parser, however, does not bother with such niceties when creating an XML file. Is there a "pretty printer" function somewhere that makes XML easier to read by adding the indenting?

Not sure how you are reading the XML.
Most browsers will render XML all pretty like you want. The XML itself doesn't care about the formatting so it's really up to the viewer you use. A simple text editor will not do what you want as I'm sure you've found. Here's a similar discussion http://tinyurl.com/68zkg OTOH you could use XSLT to transform your XML to the format you want....
 

jmm-list-gn

Usenet Archive
Joined
Jul 29, 2004
Messages
30
Reaction score
0
Patrick said:
% Is there a "pretty printer" function somewhere that makes XML easier to % read by adding the indenting?

xmllint from the libxml distribution has a --format option which might do what you want. http://xmlsoft.org
Yes, that is exactly it. Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top