Dossy wrote:
> Does this one not break the XML document?  AFAIK, the current pretty
> printer does NOT output a document that's identical to the one
> represented in memory:

All pretty printers "break" the XML document, if by "break" you mean 
changing the text nodes.  By definition, that's what pretty printing does.

I'm not sure how well Thomas' works; I scanned it for potential nasty 
behavior, and then included it in the configs. I haven't played around with 
it much.  It does add line breaks, though.

> Or, something like that.  What the pretty-printer really
> needs to output is:
> 
> <blah>
>   <foo>abc</foo>
>   <bar>def</bar>
> </blah>

Hmmm?  This doesn't produce an identical document, either, because it adds 
whitespace which isn't ignored.

http://www.w3.org/TR/REC-xml#sec-white-space
"An XML processor must always pass all characters in a document that are not 
markup through to the application."

So, with:

> <blah><foo>abc</foo><bar>def</bar></blah>

your preferred output

> <blah>
>   <foo>abc</foo>
>   <bar>def</bar>
> </blah>

becomes

<blah>\n  <foo>abc</foo>\n  <bar>def</bar>\n<blah>

so no matter how you cut it, you're still adding whitespace that wasn't in 
the original document.

> I'll have to grab the 2.3.3 release and bring the pretty printer
> back to 2.2.2 if this is what Tom's pretty printer does, otherwise,
> is it a big deal to get the pretty printer I'm asking for?

Specifically, you're asking that whitespace be not added to text nodes, but 
everywhere else... is that correct?  This would be fairly easy.

Does anybody like the current pretty printer enough for me to not change it 
to Dossy's recommendation?  I think it's a pretty good idea.  Dossy, I'll 
change it and send you a patch.

> Sean, thanks for a great XML package!  It's made adopting Ruby for
> a project a very painless task!

You're welcome, and thanks!

--- SER