right now I'm using HtmlAgilityPack. 
but it very hard to select by Xpath.
In Java I know Jsoup. Is there any .net library that does the same?
parse Html and uses CSS style slectors to find elements.
right now I'm using HtmlAgilityPack. 
but it very hard to select by Xpath.
In Java I know Jsoup. Is there any .net library that does the same?
parse Html and uses CSS style slectors to find elements.
Try Fizzler with HtmlAgilityPack.
Fizzler is:
A .NET library to select items from a node tree based on a CSS selector. The default implementation is based on HTMLAgilityPack and selects from HTML documents.
Example from project website:
// Load the document using HTMLAgilityPack as normal
var html = new HtmlDocument();
html.LoadHtml(@"
  <html>
      <head></head>
      <body>
        <div>
          <p class='content'>Fizzler</p>
          <p>CSS Selector Engine</p></div>
      </body>
  </html>");
// Fizzler for HtmlAgilityPack is implemented as the 
// QuerySelectorAll extension method on HtmlNode
var document = htmlDocument.DocumentNode;
// yields: [<p class="content">Fizzler</p>]
document.QuerySelectorAll(".content"); 
// yields: [<p class="content">Fizzler</p>,<p>CSS Selector Engine</p>]
document.QuerySelectorAll("p");
// yields empty sequence
document.QuerySelectorAll("body>p");
// yields [<p class="content">Fizzler</p>,<p>CSS Selector Engine</p>]
document.QuerySelectorAll("body p");
// yields [<p class="content">Fizzler</p>]
document.QuerySelectorAll("p:first-child");
You could try this library, which looks very promising to me. I didn't try it myself, so maybe you wanna share your experience with us if you give that library a try.
Library: CsQuery Website: https://github.com/jamietre/CsQuery Sample:
// get all elements that are first children within 'body' (e.g. excluding 'head')
var childSpans = dom["body"].Find(":first-child");