Hi Peter It seems that #preservesIgnorableWhitespace: is only adhered to "...When validation is enabled and a DTD with element declarations is present..." (See comment in SAX2ContentHandler>>ignorableWhitespace:) The actual parsing code is in SAXParserDriver>>handleWhitespace:
What you could do is use #removeAllFormattingNodes but your-mileage-may-vary... parser := XMLDOMParser on:'<root> <tab/> <twoSpaces/> <fourSpaces/> </root>'. (parser parseDocument) removeAllFormattingNodes; prettyPrinted. Regards Carlo On 14 Aug 2018, at 13:08, Peter Uhnak <i.uh...@gmail.com> wrote: Hi, I am trying to output a pretty printed document, but it seems that the configuration is being ignored doc := '<root> <tab/> <twoSpaces/> <fourSpaces/> </root>' parseXML. String << [ :stream | doc printOn: stream beforeWritingDo: [ :writer | writer enablePrettyPrinting; enablePlatformSpecificLineBreak. writer formatter indentString: ' '. ] ] produces "'<root> <tab/> <twoSpaces/> <fourSpaces/> </root>'" I thought that maybe #preservesIgnorableWhitespace: has something to do with it, but whether it is true or false, the output is not pretty printed (not to mention, that pretty printing should ignore any preserved whitespaces anyway). Is this a bug? Should I print it in a different way? Thanks, Peter