views:

40

answers:

2

Is there any way to pretty print an HTML or XML string from the command line on a mac? Trying to do this in Ruby. Any ideas? I've thought about XSLT, and about writing my own parser, but both of those are pretty involved. Looking for something already out there.

+1  A: 

Something like Tidy?

rfusca
+2  A: 

XML files

xmllint --format file.xml

HTML files

xmllint --format --html file.html

http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/xmllint.1.html

Ivan Kruchkoff