Getting error loading html as xml

Topics: User Forum
Oct 13, 2006 at 6:48 AM
i'm trying to load html url as xml and i'm getting the following error:
"An XML comment cannot contain '--', and '-' cannot be the last character."
here is my code:

private XmlDocument GetURLAsXML(string url)
HtmlWeb htmlWeb = new HtmlWeb();
MemoryStream memoryStream = new MemoryStream();
XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, null);
htmlWeb.LoadHtmlAsXml(url, xmlTextWriter);

// rewind the memory stream
memoryStream.Position = 0;

// create, fill, and return the xml document
XmlDocument xmlDoc = new XmlDocument();
string xmlDocContent = (new StreamReader(memoryStream)).ReadToEnd();

return xmlDoc;

the url i'm actually trying to load is:
Oct 18, 2006 at 1:13 PM
This should work - for me :-)

HtmlAgilityPack.HtmlWeb oWeb = new HtmlAgilityPack.HtmlWeb();

System.Xml.XmlTextWriter oTxt = new System.Xml.XmlTextWriter("c:\\temp\\test.xml",null);

string sURL = ""



Does it work for you, too? :-)
Jan Waiz