From: Sean O'Dell Date: 2002-05-16T05:20:13+09:00 Subject: Re: ANN: REXML 2.3.3 Sean Russell wrote: > Sean O'Dell wrote: > >>Dossy has a point, although pretty printing XML is problematic in >>itself. If there are sub-keys, it's often assumed the parent key >>doesn't have data so the whitespace doesn't matter. Most pretty >>printing I've seen ignores extra parent whitespace and just makes sure >>the keys with data and no sub-keys is tight. >> > > Right. We'll get nice pretty printing; I haven't worked on it much, but it > should be improved. I'm working with Dossy right now on narrowing down > what he expects from pretty printing, then I'll submit it and see what > people think. That's why we have a development branch of REXML :-) > > However, I too have a point. Any time you insert whitespace to do pretty > printing, you're changing the document. Pretty printing is not a > transitive operation, for "correct" XML processors, because (according to > the XML spec) the processor must always report all whitespace to the > application. Hmm...I'm thinking of how maybe the two could be mixed...hmm. I wonder if maybe you could check for a particular attribute of an element. Maybe raw="true"|"false." If true, just print the data "as-is" from there on out; indent the starting and ending elements and give the ending element its usual newline, but within the start/end tags just output it normally. Sean