简体   繁体   中英

Reading XML from webBrowser control

I am trying to load the XML like this:

XmlDocument doc = new XmlDocument();

doc.LoadXml(webBrowser1.DocumentText.ToString());

I always get this an XmlException thrown, with the message Reference to undeclared entity 'nbsp'. Line 73, position 18. Reference to undeclared entity 'nbsp'. Line 73, position 18. each time.

Does anyone know what I am doing wrong and what I can do to prevent this, the XML page is dynamically generated each time using PHP and it reads cookies which have been added previously when the user is logged in.

Replace:

doc.LoadXml(webBrowser1.DocumentText.ToString());

with:

doc.LoadXml(webBrowser1.DocumentText.ToString().Replace(" ", " "));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM