c# - XmlReader read document with unescaped &s -


I am trying to parse an XMl document that I found in a string with the web service call.

  string content = ...; // Using the long XML document (TextReader Reader = New StringReader (Content)) (XmlReader xml_reader = XmlReader.Create (reader, settings)) {XML = New XPathDocument (xml_reader); }  

Although I get an exception:

  EntityName encountered an error while parsing line1, position 1721  

I looked through the document around that character and it was in the middle of a random tag, even then 20-30 characters ago I would not have left the ampersand that looked (& amp; letters), so im thinking That's this problem.

Running:

  content.Substring (1700, 100); // Results in the following text "Aleu"> 1 and amp; per day; ^ Honey ~ and water \\\\ & lt; / Value & gt; & Lt; / Frequency & gt; & Lt; / Direction & gt; & Lt; / Directions & gt; "^ Unscad- How can I succeed in this document as an XML?   

verified Make sure that your XML encoding matches something like (top of document, & lt;; xml version = "1.0" encoding = "ISO-8859-9" & gt; ). (XmlReader R = XmlReader.Create (use the new StreamReader (filename, encoding .get encoding) to replace the value from the webservice xml document for webserviceEncoding ) {X ML = New XPathDocument (r); // ...}

If that does not work

  1. Inform the web site vendor
before translating it into a string

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -