FOLLOW US
4dots Software CODE BLOG
VEGAS Movie Studio

How to XML Encode a String

To XML encode a string do the following :
VEGAS Movie Studio

 
		string text_to_encode="this is < a test > !";
		
		XmlDocument xmlDoc = new XmlDocument();

        XmlElement xmlElement = xmlDoc.CreateElement("Str");

        xmlElement.InnerText = text_to_encode;

        string xml_encoded_text= xmlElement.InnerXml;

Please note that you have to also add "using System.XML;" on the top.
Music Maker - Free Full Version

Download Demo Project

Encode Decode Demo Project
 

Please Donate!