xpath alternatives and similar packages
Based on the "Specific Formats" category.
Alternatively, view xpath alternatives based on common mentions on social networks and blogs.
-
bluemonday
bluemonday: a fast golang HTML sanitizer (inspired by the OWASP Java HTML Sanitizer) to scrub user generated content of XSS -
mxj
Decode / encode XML to/from map[string]interface{} (or JSON); extract values with dot-notation paths and wildcards. Replaces x2j and j2x packages. -
html-to-markdown
โ๏ธ Convert HTML to Markdown. Even works with entire websites and can be extended through rules. -
omniparser
omniparser: a native Golang ETL streaming parser and transform library for CSV, JSON, XML, EDI, text, etc. -
go-pkg-rss
This package reads RSS and Atom feeds and provides a caching mechanism that adheres to the feed specs. -
goribot
A simple golang spider/scraping framework,build a spider in 3 lines. -
goq
A declarative struct-tag-based HTML unmarshaling or scraping package for Go built on top of the goquery library -
xquery
XQuery lets you extract data from HTML/XML documents using XPath expression. -
github_flavored_markdown
GitHub Flavored Markdown renderer with fenced code block highlighting, clickable header anchor links. -
go-pkg-xmlx
Extension to the standard Go XML package. Maintains a node tree that allows forward/backwards browsing and exposes some simple single/multi-node search functions. -
gospider
โก Light weight Golang spider framework | ่ฝป้็ Golang ็ฌ่ซๆกๆถ -
pagser
Pagser is a simple, extensible, configurable parse and deserialize html page to struct based on goquery and struct tags for golang crawler -
csvplus
csvplus extends the standard Go encoding/csv package with fluent interface, lazy stream operations, indices and joins. -
codetree
:evergreen_tree: Parses indented code and returns a tree structure. -
jsoncolor
Colorized JSON output for Go https://godoc.org/github.com/nwidger/jsoncolor
Clean code begins in your IDE with SonarLint
Do you think we are missing an alternative of xpath or a related project?
Popular Comparisons
README
XPath
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.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 Add
- a - b Substract
- a * b Multiply
- a div b Divide
- a mod b Floating point mod, like Java.
a or b
: Booleanor
operation.a and b
: Booleanand
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() |
โ |
matches() |
โ |
name() |
โ |
namespace-uri() |
โ |
normalize-space() |
โ |
not() |
โ |
number() |
โ |
position() |
โ |
replace() |
โ |
reverse() |
โ |
round() |
โ |
starts-with() |
โ |
string() |
โ |
string-length() |
โ |
substring() |
โ |
substring-after() |
โ |
substring-before() |
โ |
sum() |
โ |
system-property() |
โ |
translate() |
โ |
true() |
โ |
unparsed-entity-url() |
โ |