Skip to content
forked from atifaziz/Hazz

CSS Selectors (via Fizzler) for HtmlAgilityPack (HAP)

License

Notifications You must be signed in to change notification settings

omunroe-com/Hazz

 
 

Repository files navigation

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)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 97.2%
  • Shell 1.1%
  • Other 1.7%