Escape Unsafe XML Characters

Before introducing data into XML clients, be it within tags or attributes of tags, it's important to escape all illegal XML characters that might break the validity of the XML. This can be easily done in C# using the Escape method.
1. string SafeXml = System.Security.SecurityElement.Escape("The string goes here...");

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top