The Xerces parser insists on adding whitespaces in the original document into the DOM as text nodes.
These are the whitespaces you see when you use the Serializer, not the pretty printing of the serializer. If you extract all these whitespaces from the original personal.xml, or test run it with ProjectX (which does not add these whitespaces), you will get the pretty printing you expect to. arkin Wong Kok Wai wrote: > > Hi, > > Ref: Xerces 1.0.1 > > I've tried out the new org.apache.xml.serialize package and find that > the pretty printing is not as "pretty" as I've expected. Attached is the > modified DOMWriter from the samples. Try running it with personal.xml as > the input file and open the output file testout.dat and see what I mean. > > ------------------------------------------------------------------------ > Name: DOMWriter2.java > DOMWriter2.java Type: application/x-unknown-content-type-java_auto_file > Encoding: base64