W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 1999

Re: Pretty printing XML

From: Dave Raggett <dsr@w3.org>
Date: Wed, 10 Nov 1999 19:50:41 +0000 (GMT Standard Time)
To: Jelks Cabaniss <jelks@jelks.nu>
cc: html-tidy@w3.org
Message-ID: <Pine.WNT.4.10.9911101946340.716-100000@OEMCOMPUTER>
On Thu, 28 Oct 1999, Jelks Cabaniss wrote:

> I tried the Oct. 22 Tidy on this snippet to check it's XML
> "pretty printing" capabilities:
> 
> 	<doc>
> 	<fee><fi><fo><foo>foo stuff</foo></fo></fi></fee>
> 	</doc>
> 
> Here are the relevant config options, followed by Tidy's output:
> 
> 	input-xml: yes
> 	output-xml: yes
> 	indent: auto
> 	add-xml-pi: no
> 	new-inline-tags: foo
> 	new-blocklevel-tags: doc, fee, fi, fo
> 
> 	<doc>
> 	  <fee>
> 	    <fi>
> 	      <fo>
> 	        <foo>
> 	          foo stuff
> 	        </foo>
> 	      </fo>
> 	    </fi>
> 	  </fee>
> 	</doc>
> 
> Shouldn't it be:
> 
> 	<doc>
> 	  <fee>
> 	    <fi>
> 	      <fo><foo>foo stuff</foo></fo>
> 	    </fi>
> 	  </fee>
> 	</doc>
> 

That would make sense, yes. When Tidy sees that the input is in XML
it doesn't bother with the tag dictionary. It uses PPrintXMLTree
rather than PPrintTree for pretty printing. It should be easy enough
to get PPrintXMLTree to check the dictionary though. Note that it
would then "know" that p should always be treated in this way, which
may not be the right thing to do.

Regards,

-- Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett
tel/fax: +44 122 578 3011 (or 2521) +44 385 320 444 (mobile)
World Wide Web Consortium (on assignment from HP Labs)
Received on Wednesday, 10 November 1999 14:50:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:42 GMT