[TxMt] Converting dense XML to easy-to-read form?

Eric O'Brien ericob at possibilityengine.com
Fri Dec 28 04:46:46 UTC 2007

I am not *writing* XML files, but I often want to understand one --  
either just for education or because I need to modify it.

Often the file in question was automatically generated and "ease of  
reading by humans" was not part of the process.

Right now, I trying to pull apart a XML file where a single element  
contains about 90 attributes.  Thankfully, they *do* seem to be  
ordered alphabetically, but they are all run together in a single  
line.  That is, there are no linefeeds between attributes.  Which  
would be just what I'd like (for readability anyway -- I'm hoping  
that "white space is white space and it won't matter whether those  
white-spaces are space characters or line feeds).

For this file, using Find and Replace seems to work.  (Find  
<doublequote><space> replace with <doublequote><newline>).  I don't  
know enough about XML to know if it always going to be as easy as that.

The XML bundle item "Tidy" actually runs xmllint, but I don't see a  
way to make that do what I want.

Searching Google on "XML pretty print" I came up with a number of  
hits, but many bits of code were from the year 2000 or so.

Does anyone know of any... contemporary solutions?  Or have other  



More information about the textmate mailing list