The important thing in understanding Fizzler's design, setup and dependencies is to realise that the CSS Selectors specification itself is described in terms of binding patterns against elements in a document tree. The fact that most examples cited are in terms of elements in an HTML document tree is a by-product of CSS selectors forming a core part of CSS and that all these technologies come together in rendering of a web page. That's the most common application. However, if you take CSS selectors as a querying mechanism over an arbitrary document system using a model of elements and attributes (and namespaces) then it can be applied outside of the domain of web pages. The stand-alone or base version of Fizzler does exactly that. It contains generic bits. Fizzler.Systems.HtmlAgilityPack is then a concrete implementation of the generic bits on top of the API and HTML document tree model of one concrete library: HtmlAgilityPack.
The separation enables anyone to use Fizzler to implement CSS selectors on top of another library (should another one become more current/popular) or document tree because one can reuse the CSS selectors grammar parser and the generic selection framework that have no knowledge of or ties to HtmlAgilityPack.
As one of the original authors of Fizzler, I supplied the concrete implementation for HtmlAgilityPack, which was the most popular HTML parser and DOM library for the .NET Framework (and probably remains to date). It was/is my hope that the community will then use the core library to supply implementations for other HTML libraries and document systems.
You could say that the utility of CSS selectors outside of HTML is purely academic but the Fizzler repo does contains an implementation for WinForms that, albeit being an experiment from my end, demonstrates that CSS selectors could very well be used to select controls of a form based on their name (mapped as ID) and properties (mapped as attributes). You could imagine applying a CSS-like styling language for WinForms controls and use CSS selectors to define what styles get applied to which controls.
The architecture and design of Fizzler is the reason you won't find any documentation or example making pure use of the core library. It's perhaps too generic for someone looking for immediate and practical use in an application. Documentation and examples would make most sense for people looking to implement CSS selection on top of other libraries and element trees. While this may be lacking in written English form, it was my hope that Fizzler.Systems.HtmlAgilityPack (along with some other) would serve as a good and simple study (the core of which can be boiled down to less than 200 lines of code).
Fizzler.Systems.HtmlAgilityPack itself is documented by virtue of using two standards: CSS Selectors and Selectors API. The latter adds QuerySelector
and QuerySelectorAll
for HtmlNode
from HtmlAgilityPack, just as you would find in the browser.