c# xml string special characters
Posted
by
sam
on Stack Overflow
See other posts from Stack Overflow
or by sam
Published on 2012-06-08T04:14:56Z
Indexed on
2012/06/08
4:40 UTC
Read the original article
Hit count: 293
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
© Stack Overflow or respective owner