> The DOM spec doesn't specify what pretty printing does. I believe what > Xerces is doing is fine.
By definition, pretty-printing changes whitespace and should not be used in situations where the whitespace is significant. If you want to be sure you're preserving document semantics, use basic DOM serialization instead... or set up a much more detailed prettyprint which understands exactly where whitespace is and isn't significant in this kind of document.