MCPcopy Create free account
hub / github.com/antchfx/htmlquery / QuerySelector

Function QuerySelector

query.go:73–79  ·  view source on GitHub ↗

QuerySelector returns the first matched html.Node by the specified XPath selector.

(top *html.Node, selector *xpath.Expr)

Source from the content-addressed store, hash-verified

71
72// QuerySelector returns the first matched html.Node by the specified XPath selector.
73func QuerySelector(top *html.Node, selector *xpath.Expr) *html.Node {
74 t := selector.Select(CreateXPathNavigator(top))
75 if t.MoveNext() {
76 return getCurrentNode(t.Current().(*NodeNavigator))
77 }
78 return nil
79}
80
81// QuerySelectorAll searches all of the html.Node that matches the specified XPath selectors.
82func QuerySelectorAll(top *html.Node, selector *xpath.Expr) []*html.Node {

Callers 1

QueryFunction · 0.85

Calls 3

CreateXPathNavigatorFunction · 0.85
getCurrentNodeFunction · 0.85
CurrentMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…