forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Addi <a...@rocktreesky.com>
Subject Re: Automated formatting of XML files
Date Mon, 29 Aug 2005 20:33:30 GMT
Diwaker Gupta wrote:

>>I think that it is doing too much, e.g. removing the
>>blank lines before major elements, e.g. <xsl:template>
>>    
>>
>
>Hmm, I can't seem to make Tidy not do this :-( Is this a blocker? If
>not, then I'd like to stick with Tidy. If it is, read on.
>  
>
I'm not sure if it is a blocker but I think it would be nice to retain 
the blank lines if we can since it makes it a little easier to follow 
the code, especially for someone like me that is relatively new to xml.  
The question is, is there a tool that will do it?  See below.

>I was researching XML pretty printers a bit to see if we had
>alternatives. It seems one can just write a simple stylesheet [1] to
>clean up XML (since its part of the XSL language -- see the xsl:output
>element [2])
>
>[1] http://lists.xml.org/archives/xml-dev/200110/msg00620.html
>[2] http://www.zvon.org/xxl/XSLTreference/Output/xslt_output.html
>
>Although I haven't tried this method yet and its not configurable at
>all. So I'm not sure how well it'll work.
>  
>
I did go ahead and test this (using xalan:indent-amount="2" rather than 
the saxon example) and it gave an identical file to the tidy file 
(except that the line wrap was longer).  It removed the blank lines as 
well.

What I have used on the test files so far to clean them up with minimal 
impact is jEdit with the Whitespace and XML Indenter plugins.  The 
whitespace cleans the tabs and spaces and the indenter sets the proper 
depth and doesn't touch anything else.  I assume other editors could do 
similar things.

So do we all want to work with the same editor for cleaning or do we 
want to use a cleaning tool and give up our blank lines in XML files?

- Addi


Mime
View raw message