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

Function QuerySelector

query.go:119–125  ·  view source on GitHub ↗

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

(top *Node, selector *xpath.Expr)

Source from the content-addressed store, hash-verified

117// QuerySelector returns the first matched XML Node by the specified XPath
118// selector.
119func QuerySelector(top *Node, selector *xpath.Expr) *Node {
120 t := selector.Select(CreateXPathNavigator(top))
121 if t.MoveNext() {
122 return getCurrentNode(t)
123 }
124 return nil
125}
126
127// FindEach searches the html.Node and calls functions cb.
128// Important: this method is deprecated, instead, use for .. = range Find(){}.

Callers 2

QueryFunction · 0.85
parseMethod · 0.85

Calls 2

CreateXPathNavigatorFunction · 0.85
getCurrentNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…