Reputation: 149
I have found that there exists "&"
in my code that's why error is showing
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(dsExport.Tables[0].Rows[i]["SubmissionData"].ToString());
The "&" is there in submissiondata . How can I remove the special characters so that the error doesn't show again ?
Thanks in advance
Upvotes: 4
Views: 14013
Reputation: 1
Sorry I am replying too late but I hope it will help some other guys. This issue is because of the encoding of special characters in XML. Please find the below link which may help you https://support.google.com/checkout/sell/answer/70649?hl=en
Thanks,
Vijay Sherekar
Upvotes: -1
Reputation: 1301
Try:
XmlDocument xmlDoc = new XmlDocument();
string str = dsExport.Tables[0].Rows[i]["SubmissionData"].ToString();
str = System.Web.HTTPUtility.HTMLDecode(str);
xmlDoc.LoadXml(str);
Upvotes: 0
Reputation: 1301
& is not an illegal XML character. This is not your problem. You need to log the XML that you receive, before you ask anyone about your problem. You probably need to
HTTPUtility.HTMLDecode(yourformdata)
But I smell SQL injection a long way.
Upvotes: 0