I want to create an app that takes something from a web page and that shows it to the user. In order to do this thing, i used HtmlAgilityPack. I added the reference to the project (v. 1.4.6.0 from NuGet) and i used the code that a user posted in another question some years ago.
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
// There are various options, set as needed
htmlDoc.OptionFixNestedTags = true;
// filePath is a path to a file containing the html
htmlDoc.Load(filePath);
if (htmlDoc.ParseErrors != null && htmlDoc.ParseErrors.Count() > 0)
{
// Handle any parse errors as required
}
else
{
if (htmlDoc.DocumentNode != null)
{
HtmlAgilityPack.HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body");
if (bodyNode != null)
{
// Do something with bodyNode
}
}
}
My problem is that i get the following error:
The type 'System.Xml.XPath.IXPathNavigable' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml.XPath, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
So i tried to add the reference using the following dll:
c:\Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Libraries\Client\System.Xml.XPath.dll
But this time i get the following error (i translated it because i get an italian error, so it may not be the correct translation):
It is not possible to add a reference to an assembly to the project that is not compatible or of an above version
What can i do?