How to use fizzler external lib under Monodevelop
I got a compile error using Fizzler lib (http://code.google.com/p/fizzler/) in Monodevelop IDE under Ubuntu 10. I added .Net Assembly Referen开发者_Go百科ces and autocompletion works file, but error during the compilation occurred.
Code here:
using System; using Fizzler.Systems.HtmlAgilityPack; using HtmlAgilityPack; using System.Collections.Generic; namespace test { class MainClass { public static void Main (string[] args) { HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument(); html.LoadHtml(@"some html"); HtmlAgilityPack.HtmlNode document = html.DocumentNode; document.QuerySelector("a"); } } }
Error CS1061: Type HtmlAgilityPack.HtmlNode' does not contain a definition for
QuerySelector' and no extension method QuerySelector' of type
HtmlAgilityPack.HtmlNode' could be found (are you missing a using directive or an assembly reference?) (CS1061) (test)
Are your HtmlAgilityPack.HtmlNode has that definition provided? Check again the API documentation. Please the error is clear by itself.
You may have found the answer to this question by now but I will post one anyway, since people may come across this page while looking for an answer.
Replace:
using Fizzler.Systems.HtmlAgilityPack;
with:
using myFizzler= Fizzler.Systems.HtmlAgilityPack.HtmlNodeSelection;
and call it like this in your project:
HtmlNode h2 = myFizzler.QuerySelector(document, "#fbTimelineHeadline h2");
I hope this helps.
精彩评论