Skip to content

Commit 6b4c731

Browse files
committed
Updated readme with more information
1 parent 4260870 commit 6b4c731

File tree

2 files changed

+51
-19
lines changed

2 files changed

+51
-19
lines changed

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,45 @@
1+
![logo](https://raw.githubusercontent.com/AngleSharp/AngleSharp.XPath/master/header.png)
2+
13
# AngleSharp.XPath
24

35
[![Build Status](https://travis-ci.org/denis-ivanov/AngleSharp.XPath.svg?branch=master&style=flat-square)](https://travis-ci.org/denis-ivanov/AngleSharp.XPath)
4-
[![NuGet](http://img.shields.io/nuget/v/AngleSharp.XPath.svg)](https://www.nuget.org/packages/AngleSharp.XPath/)
6+
[![GitHub Tag](https://img.shields.io/github/tag/AngleSharp/AngleSharp.XPath.svg?style=flat-square)](https://github.com/AngleSharp/AngleSharp.XPath/releases)
7+
[![NuGet Count](https://img.shields.io/nuget/dt/AngleSharp.XPath.svg?style=flat-square)](https://www.nuget.org/packages/AngleSharp.XPath/)
8+
[![Issues Open](https://img.shields.io/github/issues/AngleSharp/AngleSharp.XPath.svg?style=flat-square)](https://github.com/AngleSharp/AngleSharp.XPath/issues)
9+
[![StackOverflow Questions](https://img.shields.io/stackexchange/stackoverflow/t/anglesharp.svg?style=flat-square)](https://stackoverflow.com/tags/anglesharp)
10+
[![CLA Assistant](https://cla-assistant.io/readme/badge/AngleSharp/AngleSharp.XPath?style=flat-square)](https://cla-assistant.io/AngleSharp/AngleSharp.XPath)
11+
12+
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.
13+
14+
## Basic Use
15+
16+
With this library using XPath queries is as simple as writing
17+
18+
```cs
19+
var contentNode = document.Body.SelectSingleNode("//div[@id='content']");
20+
```
21+
22+
Besides `SelectSingleNode` we can also use `SelectNodes`. Both are extension methods defined in the `AngleSharp.XPath` namespace.
23+
24+
## Features
25+
26+
- Uses `XPathNavigator` from `System.Xml.XPath`
27+
28+
## Participating
29+
30+
Participation in the project is highly welcome. For this project the same rules as for the AngleSharp core project may be applied.
31+
32+
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.
33+
34+
## License
35+
36+
The MIT License (MIT)
37+
38+
Copyright (c) 2018 - 2019 Denis Ivanov, AngleSharp
39+
40+
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:
41+
42+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
43+
44+
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.
45+

src/AngleSharp.XPath/HtmlDocumentNavigator.cs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,36 +91,27 @@ public override XPathNodeType NodeType
9191

9292
case Dom.NodeType.Document:
9393
return XPathNodeType.Element;
94-
95-
//case Dom.NodeType.DocumentFragment:
96-
// return XPathNodeType.;
97-
98-
//case Dom.NodeType.DocumentType:
99-
// return XPathNodeType.;
100-
101-
case Dom.NodeType.Element:
94+
95+
case Dom.NodeType.Element:
10296
if (_attrIndex != -1)
10397
{
10498
return XPathNodeType.Attribute;
10599
}
106100

107101
return XPathNodeType.Element;
108102

109-
//case Dom.NodeType.Entity:
110-
// return XPathNodeType.en;
111-
112-
//case Dom.NodeType.EntityReference:
113-
114-
//case Dom.NodeType.Notation:
115-
// return XPathNodeType.;
116-
117-
case Dom.NodeType.ProcessingInstruction:
103+
case Dom.NodeType.ProcessingInstruction:
118104
return XPathNodeType.ProcessingInstruction;
119105

120106
case Dom.NodeType.Text:
121107
return XPathNodeType.Text;
122108

123-
default:
109+
case Dom.NodeType.Entity:
110+
case Dom.NodeType.EntityReference:
111+
case Dom.NodeType.Notation:
112+
case Dom.NodeType.DocumentFragment:
113+
case Dom.NodeType.DocumentType:
114+
default:
124115
throw new NotImplementedException();
125116
}
126117
}

0 commit comments

Comments
 (0)