Friday, April 22, 2011

Handling special characters in XML strings in C#.Net

There are set of characters that cannot be used in normal in XML a strings. If there are any of these characters in a xml string it will break xml parsing. But if you still want to include these characters in xml string we have to replace those characters according to the following list. 

















If you need to construct xml strings in a C# program you can escape those characters using
SecurityElement.Escape(XmlValue) method given by the .Net framework. 











Using above method you can easily pass those special charactors via xml string without any trouble. 


No comments:

Post a Comment