Re: Converting dense XML to easy-to-read form?
Pedro Melo <
melo@...>
2008-01-01 01:19:48 GMT
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
(Continue reading)