Nope. setPreserveSpace defines the behavior of printing your text contents, it corresponds to xml:space, and I don't think it's implemented. As Tim and others pointed out, this sort of whitespace handling does break some applications, so I gave it a rest.
The problem in your case is the whitespace between elements, which is just there in the document to make it look better. The serializer has no way of telling it's white space (I'm thinking of a fix for that, though :-) ) and prints it. Once it's printer, the serializer cannot mess with it by adding indentation, that is a clear violation of the information model. Try reading the document with the SAX praser and feeding it directly to the Serializer and see if it works. arkin Wong Kok Wai wrote: > > Doesn't using setPreserveSpace(false) in OutputFormat takes care of this? > > Assaf Arkin wrote: > > > > > 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. > >