Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: Can only load xml document from file system, not from web

$
0
0

Probably much too late to help you, but I ran into this problem as well.  I will post what I found in the hopes of helping others than come across this.

In HtmlWeb.cs I added the bold part:

 

private bool IsHtmlContent(string contentType)
{

return contentType.ToLower().StartsWith("text/html") || contentType.ToLower().StartsWith("text/xml");
}

 

The place where this is crucial is in HtmlWeb.cs.  Notice that the doc is never loaded if "html" is false, and html will be false because the ContentType of an online xml will be "text/xml".  That is why I made the change above.

// try to work in-memory

if ((doc != null) && (html))

{
	if (respenc != null)
	{
		doc.Load(s, respenc);
	}
	else
	{
		doc.Load(s, true);
	}
}

 


Viewing all articles
Browse latest Browse all 655

Trending Articles