Bob Hutchison wrote:

> Either
> 
> <a
>   ><b
>      ><c>C</c
>      ></b
>   ></a

Ugly, but an excellent idea.  XXE does it this way.

> If you have a DTD and i) you define it correctly; and ii) I remember
> correctly, then this:
> 
> <a>
>   <b>
>     <c>C</c>
>   </b>
> </a>
> 
> does not introduce white space unless <a> and <b> are defined to have
> mixed content.

Right.  For validating parsers.  Which REXML isn't.  Yet.

>> My feeling is that if you're doing pretty-printing, then you've
>> already decided to mess with the whitespace (based on what you expect
> 
> Not necessarily :-)

Heh.  I think this begs the question: "Are any of the other solutions really 
'pretty' printed?"  They work, but then, not introducing any CRs at all 
works, too, and looks just as good to some people.

Boy.  I'm starting to think I'm going to have to take pretty printing out of 
REXML and make an external class that can be configured based on your PP 
preferences.  I don't think I'm going to be able to satisy everybody.  
However, I've pretty much decided on this for the default REXML behavior:

1) Pretty printing will not introduce whitespace before or after text nodes.
2) You'll have an option to ignore whitespace-only nodes.

I think this is a good compromise, unless David can give me a compelling 
reason to leave it the way it is.  Personally, I think it is kind of ugly 
the way it is now, too.

--- SER