1- ![ Icon] ( https://raw.githubusercontent.com/devlooped/css/main/assets/img/icon-32.png ) XLinq to Css
1+ ![ Icon] ( https://raw.githubusercontent.com/devlooped/css/main/assets/img/icon-32.png ) HTML => XML + CSS with XLinq 🤘
22============
33
44[ ![ Version] ( https://img.shields.io/nuget/vpre/Devlooped.Xml.Css.svg?color=royalblue )] ( https://www.nuget.org/packages/Devlooped.Xml.Css )
55[ ![ Downloads] ( https://img.shields.io/nuget/dt/Devlooped.Xml.Css.svg?color=green )] ( https://www.nuget.org/packages/Devlooped.Xml.Css )
66[ ![ License] ( https://img.shields.io/github/license/devlooped/css.svg?color=blue )] ( https://github.com/devlooped/css/blob/main/license.txt )
77
8- Implements CSS selectors for XLinq.
8+ Read HTML as XML and query it with CSS over XLinq.
9+
10+ No need to learn an entirely new object model for a page 🤘.
11+ This makes it the most productive and lean library for web
12+ scraping using the latest and greatest that .NET can offer.
913
1014# Usage
1115
@@ -16,9 +20,20 @@ using Devlooped.Web;
1620XDocument page = HtmlDocument .Load (" page.html" )
1721IEnumerable < XElement > elements = page .CssSelectElements (" div.menuitem" );
1822
19- XElement title = page .CssSelectElement (" div[role=alert ]" );
23+ XElement title = page .CssSelectElement (" html head meta[name=title ]" );
2024```
2125
26+ By default, ` HtmlDocument.Load ` will skip non-content elements ` script ` and
27+ ` style ` , turn all element names into lower case, and ignore all XML namespaces
28+ (useful when loading XHTML, for example) for easier querying. These options
29+ as well as granular whitespace handling can be configured using the overloads
30+ receiving an ` HtmlReaderSettings ` .
31+
32+ The underlying parsing is performed by the amazing [ SgmlReader] ( https://www.nuget.org/packages/Microsoft.Xml.SgmlReader )
33+ library by Microsoft's [ Chris Lovett] ( http://lovettsoftware.com/ ) .
34+
35+ ## CSS
36+
2237At the moment, supports the following CSS selector features:
2338
2439- [ Type selector] ( https://www.w3.org/TR/selectors-3/#type-selectors )
0 commit comments