atifaziz / Hazz

CSS Selectors (via Fizzler) for HtmlAgilityPack (HAP)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hazz

Hazz implements CSS Selectors for HTMLAgilityPack. It is based on Fizzler, a generic CSS Selectors parser and generator library.

Hazz was previously known and distributed as Fizzler.Systems.HtmlAgilityPack.

Examples

// 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 = html.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");

About

CSS Selectors (via Fizzler) for HtmlAgilityPack (HAP)

License:Other


Languages

Language:C# 98.1%Language:Batchfile 0.8%Language:Shell 0.6%Language:HTML 0.5%