escaping strings for XML

I recognized that the quotes and apostrophes are not escaped when generating an xml-entry with XMLDocument.CreateTextNode.
The other XML escape characters (>,< and ampersand) get escaped when created. Is there a way to escape a string correctly without generating too many layers of escaped ampersands?

First escape the ampersands, then everything else. (Similarly, unescape ampersands last.)