I think you will find that carriage-return characters are being removed, but new-line characters are not being removed. That's required by section 2.11 of the XML recommendation, here: http://www.w3.org/TR/REC-xml/#sec-line-ends
And I guess you are using Notepad to view the result of this? Notepad is just about the only text editor in the world that doesn't recognize a new-line character as a line ending, so it often doesn't display XML files correctly. Try a different editor. Even Wordpad works properly.