c# xml string special characters
- by sam
Please help explain why the dataset cannot read the encoded xml?
string xml = "<?xml version=\"1.0\" standalone=\"yes\" ?>
<DataSet><node>it's my \"node\" & i like it</node></DataSet>";
string encodedXml = System.Security.SecurityElement.Escape(xml);
DataSet ds = new DataSet();
ds.ReadXml(New XmlTextReader(new StringReader(encodedXml)));
I have checked the link http://weblogs.sqlteam.com/mladenp/archive/2008/10/21/Different-ways-how-to-escape-an-XML-string-in-C.aspx
What i want to do is to read a string with special characters into a dataset. But the code cannot locate the special characters in the string, c# added all the \ so the linenumber is not accurate generated by XmlException object.
Anyone could provide the code to read a string with special characters into a dataset.
thanks very much