ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - antchfx/xpath: XPath package for Golang, supports HTML, XML, JSON document query.
XPath package for Golang, supports HTML, XML, JSON document query. - antchfx/xpath
Visit Site

GitHub - antchfx/xpath: XPath package for Golang, supports HTML, XML, JSON document query.

GitHub - antchfx/xpath: XPath package for Golang, supports HTML, XML, JSON document query.

XPath

GoDoc Coverage Status Build Status Go Report Card

XPath is Go package provides selecting nodes from XML, HTML or other documents using XPath expression.

Implementation

  • htmlquery - an XPath query package for HTML document

  • xmlquery - an XPath query package for XML document.

  • jsonquery - an XPath query package for JSON document

Supported Features

The basic XPath patterns.

The basic XPath patterns cover 90% of the cases that most stylesheets will need.

  • node : Selects all child elements with nodeName of node.

  • * : Selects all child elements.

  • @attr : Selects the attribute attr.

  • @* : Selects all attributes.

  • node() : Matches an org.w3c.dom.Node.

  • text() : Matches a org.w3c.dom.Text node.

  • comment() : Matches a comment.

  • . : Selects the current node.

  • .. : Selects the parent of current node.

  • / : Selects the document node.

  • a[expr] : Select only those nodes matching a which also satisfy the expression expr.

  • a[n] : Selects the nth matching node matching a When a filter's expression is a number, XPath selects based on position.

  • a/b : For each node matching a, add the nodes matching b to the result.

  • a//b : For each node matching a, add the descendant nodes matching b to the result.

  • //b : Returns elements in the entire document matching b.

  • a|b : All nodes matching a or b, union operation(not boolean or).

  • (a, b, c) : Evaluates each of its operands and concatenates the resulting sequences, in order, into a single result sequence

  • (a/b) : Selects all matches nodes as grouping set.

Node Axes

  • child::* : The child axis selects children of the current node.

    • child::node(): Selects all the children of the context node.
    • child::text(): Selects all text node children of the context node.
  • descendant::* : The descendant axis selects descendants of the current node. It is equivalent to '//'.

  • descendant-or-self::* : Selects descendants including the current node.

  • attribute::* : Selects attributes of the current element. It is equivalent to @*

  • following-sibling::* : Selects nodes after the current node.

  • preceding-sibling::* : Selects nodes before the current node.

  • following::* : Selects the first matching node following in document order, excluding descendants.

  • preceding::* : Selects the first matching node preceding in document order, excluding ancestors.

  • parent::* : Selects the parent if it matches. The '..' pattern from the core is equivalent to 'parent::node()'.

  • ancestor::* : Selects matching ancestors.

  • ancestor-or-self::* : Selects ancestors including the current node.

  • self::* : Selects the current node. '.' is equivalent to 'self::node()'.

Expressions

The gxpath supported three types: number, boolean, string.

  • path : Selects nodes based on the path.

  • a = b : Standard comparisons.

    • a = b : True if a equals b.
    • a != b : True if a is not equal to b.
    • a < b : True if a is less than b.
    • a <= b : True if a is less than or equal to b.
    • a > b : True if a is greater than b.
    • a >= b : True if a is greater than or equal to b.
  • a + b : Arithmetic expressions.

    • - a Unary minus
    • a + b : Addition
    • a - b : Subtraction
    • a * b : Multiplication
    • a div b : Division
    • a mod b : Modulus (division remainder)
  • a or b : Boolean or operation.

  • a and b : Boolean and operation.

  • (expr) : Parenthesized expressions.

  • fun(arg1, ..., argn) : Function calls:

Function Supported
boolean()
ceiling()
choose()
concat()
contains()
count()
current()
document()
element-available()
ends-with()
false()
floor()
format-number()
function-available()
generate-id()
id()
key()
lang()
last()
local-name()
lower-case()1
matches()
name()
namespace-uri()
normalize-space()
not()
number()
position()
replace()
reverse()
round()
starts-with()
string()
string-join()1
string-length()
substring()
substring-after()
substring-before()
sum()
system-property()
translate()
true()
unparsed-entity-url()

Footnotes

  1. XPath-2.0 expression 2

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory