Hi,
On Dec 28, 2007, at 4:46 AM, Eric O'Brien wrote:
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.
The Tidy command of the XML bundle does format the XML snippets I give it.
xmllint --format - < in_file.xml > out_file.xml
does what you want. I think it is what the XML tidy command uses.
Best regards,
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 suggestions/ideas?
Thanks!
eo
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate