The single quote predefined entity is not escaped.The other predefined entities are but not the single quote, so you will have to do it yourself.That's what you would expect:Ampersand & &Single Quote ' 'Double Quote " "Greater Than > >Less Than < <That's what you get with \XmlWriter:Ampersand & &Single Quote ' 'Double Quote " "Greater Than > >Less Than < <