{"id":18603041,"url":"https://github.com/devlooped/web","last_synced_at":"2025-04-10T19:31:28.569Z","repository":{"id":37986725,"uuid":"400324087","full_name":"devlooped/Web","owner":"devlooped","description":"XLinq to Web","archived":false,"fork":false,"pushed_at":"2024-05-26T01:07:05.000Z","size":197,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-27T17:51:02.726Z","etag":null,"topics":["csharp","css","dotnet","html","xml"],"latest_commit_sha":null,"homepage":"https://clarius.org/Web","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devlooped.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"devlooped"}},"created_at":"2021-08-26T22:42:21.000Z","updated_at":"2024-05-30T07:06:31.232Z","dependencies_parsed_at":"2024-05-17T23:28:59.109Z","dependency_job_id":"ebb45209-3dd9-479c-8f04-8bf30a9752b3","html_url":"https://github.com/devlooped/Web","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlooped%2FWeb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlooped%2FWeb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlooped%2FWeb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlooped%2FWeb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlooped","download_url":"https://codeload.github.com/devlooped/Web/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281400,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","css","dotnet","html","xml"],"created_at":"2024-11-07T02:13:21.645Z","updated_at":"2025-04-10T19:31:23.544Z","avatar_url":"https://github.com/devlooped.png","language":"HTML","funding_links":["https://github.com/sponsors/devlooped","https://github.com/sponsors"],"categories":[],"sub_categories":[],"readme":"![Icon](https://raw.githubusercontent.com/devlooped/web/main/assets/icon.png) HTML =\u003e XML + CSS with XLinq 🤘\n============\n\n[![Version](https://img.shields.io/nuget/vpre/Devlooped.Web.svg?color=royalblue)](https://www.nuget.org/packages/Devlooped.Web)\n[![Downloads](https://img.shields.io/nuget/dt/Devlooped.Web.svg?color=green)](https://www.nuget.org/packages/Devlooped.Web)\n[![License](https://img.shields.io/github/license/devlooped/web.svg?color=blue)](https://github.com/devlooped/web/blob/main/license.txt)\n\n\u003c!-- #content --\u003e\n\u003c!-- include https://github.com/devlooped/.github/raw/main/sponsorlink.md --\u003e\n*This project uses [SponsorLink](https://github.com/devlooped#sponsorlink) \nand may issue IDE-only warnings if no active sponsorship is detected.*\n\n\u003c!-- https://github.com/devlooped/.github/raw/main/sponsorlink.md --\u003e\n\nRead HTML as XML and query it with CSS over XLinq (or HtmlAgilityPack killer 😉). \nProvides `HtmlDocument.Load` and `CssSelectElement(s)` extension methods \nfor `XDocument`/`XElement`.\n\nNo need to learn an entirely new object model for a page 🤘. \nThis makes it the most productive and lean library for web \nscraping using the latest and greatest that .NET can offer.\n\n# Usage\n\n```csharp\nusing System.Xml.Linq;\nusing Devlooped.Web;\n\nXDocument page = HtmlDocument.Load(\"page.html\")\nIEnumerable\u003cXElement\u003e elements = page.CssSelectElements(\"div.menuitem\");\n\nXElement title = page.CssSelectElement(\"html head meta[name=title]\");\n```\n\nBy default, `HtmlDocument.Load` will skip non-content elements `script` and \n`style`, turn all element names into lower case, and ignore all XML namespaces \n(useful when loading XHTML, for example) for easier querying. These options \nas well as granular whitespace handling can be configured using the overloads \nreceiving an `HtmlReaderSettings`.\n\nThe underlying parsing is performed by the amazing [SgmlReader](https://www.nuget.org/packages/Microsoft.Xml.SgmlReader) \nlibrary by Microsoft's [Chris Lovett](http://lovettsoftware.com/).\n\nIn addition, the following extension methods make it easier to work \nwith XML documents where you want to query with CSS or XPath without \nhaving to deal with XML namespaces:\n\n```csharp\nusing System.Xml;\nusing System.Xml.Linq;\nusing Devlooped.Web;\n\nvar doc = XDocument.Load(\"doc.xml\")\n// Will remove all xmlns declarations, and allow querying elements \n// as if none had namespaces, returns the root element\nXElement nons = doc.RemoveNamespaces();\n\n// Alternatively, you can also ignore at the XmlReader level\nusing var reader = XmlReader.Create(\"doc.xml\").IgnoreNamespaces();\ndoc = XDocument.Load(reader);\n\n// Finally, you can also skip elements at the reader level\nusing var reader = XmlReader.Create(\"doc.xml\").SkipElements(\"foo\", \"bar\");\ndoc = XDocument.Load(reader);\n```\n\n## CSS\n\nAt the moment, supports the following CSS selector features: \n\n- [Type selector](https://www.w3.org/TR/selectors-3/#type-selectors)\n- [Universal selector](https://www.w3.org/TR/selectors-3/#universal-selector)\n- [Attribute selector](https://www.w3.org/TR/selectors-3/#attribute-selectors)\n- [Class selector](https://www.w3.org/TR/selectors-3/#class-html)\n- [ID selector](https://www.w3.org/TR/selectors-3/#id-selectors)\n- [Pseudo-classes](https://www.w3.org/TR/selectors-3/#pseudo-classes):\n    * [:checked](https://www.w3.org/TR/selectors-3/#checked)\n    * [:first-child](https://www.w3.org/TR/selectors-3/#first-child-pseudo)\n    * [:last-child](https://www.w3.org/TR/selectors-3/#last-child-pseudo)\n    * [:only-child](https://www.w3.org/TR/selectors-3/#only-child-pseudo)\n    * [:empty](https://www.w3.org/TR/selectors-3/#empty-pseudo)\n    * [:first-of-type](https://www.w3.org/TR/selectors-3/#first-of-type-pseudo)\n    * [:last-of-type](https://www.w3.org/TR/selectors-3/#last-of-type-pseudo)\n    * [:not(...)](https://www.w3.org/TR/selectors-3/#negation)\n    * [:nth-of-type(n)](https://www.w3.org/TR/selectors-3/#nth-of-type-pseudo)\n    * [:nth-child(n)](https://www.w3.org/TR/selectors-3/#nth-child-pseudo)\n    * [:has(...)](https://www.w3.org/TR/selectors-4/#has-pseudo)\n\nAnd all [combinators](https://www.w3.org/TR/selectors-3/#combinators)\n\nNon-CSS features:\n\n- `text()` pseudo-attribute selector: selects the node text contents, as specified \n  in the [XPath](https://www.w3.org/TR/1999/REC-xpath-19991116/) `text()` location \n  path. Can be used instead of an attribute name selector, such as `div[text()=foo]`. \n  All [attribute value selectors](https://www.w3.org/TR/selectors-3/#attribute-selectors) \n  are also supported:\n    * `[text()=val]`: Represents an element whose text contents is exactly \"val\".\n    * `[text()~=val]`: Represents an element whose text contents is a whitespace-separated list of words, \n       one of which is exactly \"val\". If \"val\" contains whitespace, it will never represent anything (since the words \n       are separated by spaces). Also if \"val\" is the empty string, it will never represent anything.\n    * `[text()|=val]`: Represents an element whose text contents either being exactly \"val\" or \n       beginning with \"val\" immediately followed by \"-\" (U+002D). \n    * `[text()^=val]`: Represents an element whose text contents begins with the prefix \"val\". \n       If \"val\" is the empty string then the selector does not represent anything.\n    * `[text()$=val]`: Represents an element whose text contents ends with the suffix \"val\". \n       If \"val\" is the empty string then the selector does not represent anything.\n    * `[text()*=val]`: Represents an element whose text contents contains at least one instance of the \n       substring \"val\". If \"val\" is the empty string then the selector does not represent anything.\n\n\u003c!-- #content --\u003e\n\n# Dogfooding\n\n[![CI Version](https://img.shields.io/endpoint?url=https://shields.kzu.io/vpre/Devlooped.Web/main\u0026label=nuget.ci\u0026color=brightgreen)](https://pkg.kzu.io/index.json)\n[![Build](https://github.com/devlooped/web/workflows/build/badge.svg?branch=main)](https://github.com/devlooped/web/actions)\n\nWe also produce CI packages from branches and pull requests so you can dogfood builds as quickly as they are produced. \n\nThe CI feed is `https://pkg.kzu.io/index.json`. \n\nThe versioning scheme for packages is:\n\n- PR builds: *42.42.42-pr*`[NUMBER]`\n- Branch builds: *42.42.42-*`[BRANCH]`.`[COMMITS]`\n\n\n\u003c!-- #sponsors --\u003e\n\u003c!-- include https://github.com/devlooped/sponsors/raw/main/footer.md --\u003e\n# Sponsors \n\n\u003c!-- sponsors.md --\u003e\n[![Clarius Org](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/clarius.png \"Clarius Org\")](https://github.com/clarius)\n[![Kirill Osenkov](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/KirillOsenkov.png \"Kirill Osenkov\")](https://github.com/KirillOsenkov)\n[![MFB Technologies, Inc.](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/MFB-Technologies-Inc.png \"MFB Technologies, Inc.\")](https://github.com/MFB-Technologies-Inc)\n[![Torutek](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/torutek-gh.png \"Torutek\")](https://github.com/torutek-gh)\n[![DRIVE.NET, Inc.](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/drivenet.png \"DRIVE.NET, Inc.\")](https://github.com/drivenet)\n[![Keith Pickford](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/Keflon.png \"Keith Pickford\")](https://github.com/Keflon)\n[![Thomas Bolon](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/tbolon.png \"Thomas Bolon\")](https://github.com/tbolon)\n[![Kori Francis](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/kfrancis.png \"Kori Francis\")](https://github.com/kfrancis)\n[![Toni Wenzel](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/twenzel.png \"Toni Wenzel\")](https://github.com/twenzel)\n[![Uno Platform](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/unoplatform.png \"Uno Platform\")](https://github.com/unoplatform)\n[![Dan Siegel](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/dansiegel.png \"Dan Siegel\")](https://github.com/dansiegel)\n[![Reuben Swartz](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/rbnswartz.png \"Reuben Swartz\")](https://github.com/rbnswartz)\n[![Jacob Foshee](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/jfoshee.png \"Jacob Foshee\")](https://github.com/jfoshee)\n[![](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/Mrxx99.png \"\")](https://github.com/Mrxx99)\n[![Eric Johnson](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/eajhnsn1.png \"Eric Johnson\")](https://github.com/eajhnsn1)\n[![Ix Technologies B.V.](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/IxTechnologies.png \"Ix Technologies B.V.\")](https://github.com/IxTechnologies)\n[![David JENNI](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/davidjenni.png \"David JENNI\")](https://github.com/davidjenni)\n[![Jonathan ](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/Jonathan-Hickey.png \"Jonathan \")](https://github.com/Jonathan-Hickey)\n[![Charley Wu](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/akunzai.png \"Charley Wu\")](https://github.com/akunzai)\n[![Jakob Tikjøb Andersen](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/jakobt.png \"Jakob Tikjøb Andersen\")](https://github.com/jakobt)\n[![Seann Alexander](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/seanalexander.png \"Seann Alexander\")](https://github.com/seanalexander)\n[![Tino Hager](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/tinohager.png \"Tino Hager\")](https://github.com/tinohager)\n[![Mark Seemann](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/ploeh.png \"Mark Seemann\")](https://github.com/ploeh)\n[![Ken Bonny](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/KenBonny.png \"Ken Bonny\")](https://github.com/KenBonny)\n[![Simon Cropp](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/SimonCropp.png \"Simon Cropp\")](https://github.com/SimonCropp)\n[![agileworks-eu](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/agileworks-eu.png \"agileworks-eu\")](https://github.com/agileworks-eu)\n[![sorahex](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/sorahex.png \"sorahex\")](https://github.com/sorahex)\n[![Zheyu Shen](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/arsdragonfly.png \"Zheyu Shen\")](https://github.com/arsdragonfly)\n[![Vezel](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/vezel-dev.png \"Vezel\")](https://github.com/vezel-dev)\n[![ChilliCream](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/ChilliCream.png \"ChilliCream\")](https://github.com/ChilliCream)\n[![4OTC](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/4OTC.png \"4OTC\")](https://github.com/4OTC)\n[![Vincent Limo](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/v-limo.png \"Vincent Limo\")](https://github.com/v-limo)\n\n\n\u003c!-- sponsors.md --\u003e\n\n[![Sponsor this project](https://raw.githubusercontent.com/devlooped/sponsors/main/sponsor.png \"Sponsor this project\")](https://github.com/sponsors/devlooped)\n\u0026nbsp;\n\n[Learn more about GitHub Sponsors](https://github.com/sponsors)\n\n\u003c!-- https://github.com/devlooped/sponsors/raw/main/footer.md --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlooped%2Fweb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlooped%2Fweb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlooped%2Fweb/lists"}