AngleSharp.XPath 2.0.4

dotnet add package AngleSharp.XPath --version 2.0.4                
NuGet\Install-Package AngleSharp.XPath -Version 2.0.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AngleSharp.XPath" Version="2.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AngleSharp.XPath --version 2.0.4                
#r "nuget: AngleSharp.XPath, 2.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AngleSharp.XPath as a Cake Addin
#addin nuget:?package=AngleSharp.XPath&version=2.0.4

// Install AngleSharp.XPath as a Cake Tool
#tool nuget:?package=AngleSharp.XPath&version=2.0.4                

logo

AngleSharp.XPath

Build Status GitHub Tag NuGet Count Issues Open Gitter Chat StackOverflow Questions CLA Assistant

AngleSharp.XPath extends AngleSharp with the ability to select nodes via XPath queries instead of CSS selector syntax. This is more powerful and potentially more common for .NET developers working with XML on a daily basis.

Basic Use

With this library using XPath queries is as simple as writing

var contentNode = document.Body.SelectSingleNode("//div[@id='content']");

Besides SelectSingleNode we can also use SelectNodes. Both are extension methods defined in the AngleSharp.XPath namespace.

If wanted we can also use XPath directly in CSS selectors such as in QuerySelector or QuerySelectorAll calls. For this we only need to apply the following configuration:

var config = Configuration.Default.WithXPath();

Now we can write queries such as

var secondLi = document.QuerySelector("*[xpath>'//li[2]']");

It is important that the original selector has all elements (*) as the intersection of the ordinary CSS selector and the XPath attribute is considered. The XPath attribute consists of a head (xpath>) and a value - provided as a string, e.g., //li[2].

Features

  • Uses XPathNavigator from System.Xml.XPath
  • Includes XPath capabilities to CSS query selectors if wanted

Participating

Participation in the project is highly welcome. For this project the same rules as for the AngleSharp core project may be applied.

If you have any question, concern, or spot an issue then please report it before opening a pull request. An initial discussion is appreciated regardless of the nature of the problem.

Live discussions can take place in our Gitter chat, which supports using GitHub accounts.

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.

For more information see the .NET Foundation Code of Conduct.

.NET Foundation

This project is supported by the .NET Foundation.

License

The MIT License (MIT)

Copyright (c) 2018 - 2023 Denis Ivanov, AngleSharp

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on AngleSharp.XPath:

Package Downloads
Optivulcan

A simple timetable parser for Optivum UONET+ written in C#

invoisys.SDK.Xml

Package Description

UnDotNet.BootstrapEmail

Package Description

Pangolin.Standard

A framework for declarative UI testing for ASP.NET apps.

ReadyNAS1500

Package Description

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on AngleSharp.XPath:

Repository Stars
JustArchiNET/ArchiSteamFarm
C# application with primary purpose of farming Steam cards from multiple accounts simultaneously.
Decimation/SmartImage
Reverse image search tool (SauceNao, IQDB, Ascii2D, trace.moe, and more)
chr233/ASFEnhance
ASF 扩展命令插件 / External commands for ASF
Version Downloads Last updated
2.0.4 74,339 4/1/2024
2.0.3 132,998 6/6/2023
2.0.2 1,569 6/1/2023
2.0.1 182,040 7/20/2022
2.0.0 2,800 6/1/2022
1.1.7 306,910 4/1/2020
1.1.6 20,569 1/6/2020
1.1.5 6,381 11/16/2019
1.1.4 16,910 5/22/2019
1.1.3 25,378 5/6/2019
1.1.2 32,275 4/11/2019
1.1.1 933 3/1/2019
1.1.0 2,424 1/6/2019
1.0.2 93,262 3/9/2018
1.0.1 1,200 1/5/2018
1.0.0 1,598 1/5/2018