Showing posts with label escape. Show all posts
Showing posts with label escape. Show all posts

Friday, June 7, 2013

Escape a XML String in C#

Given a XML string, we can manually escape by replacing invalid XML characters with their escaping characters. Below is the list of invalid XML characters and their escaping characters.
< <
> >
" "
' '
& &

Another easier way is to use the function System.Security.SecurityElement.Escape(string).