MCPcopy Index your code
hub / github.com/antchfx/xmlquery / FindOne

Function FindOne

query.go:78–84  ·  view source on GitHub ↗

FindOne is like Query but panics if `expr` is not a valid XPath expression. See `Query()` function.

(top *Node, expr string)

Source from the content-addressed store, hash-verified

76// FindOne is like Query but panics if `expr` is not a valid XPath expression.
77// See `Query()` function.
78func FindOne(top *Node, expr string) *Node {
79 node, err := Query(top, expr)
80 if err != nil {
81 panic(err)
82 }
83 return node
84}
85
86// QueryAll searches the XML Node that matches by the specified XPath expr.
87// Returns an error if the expression `expr` cannot be parsed.

Callers 15

ExampleFunction · 0.92
TestDefaultNamespace_1Function · 0.85
TestDefaultNamespace_2Function · 0.85
TestNamespaceURLFunction · 0.85
TestMissDeclarationFunction · 0.85
TestCharDataFunction · 0.85
TestLineNumbersFunction · 0.85
SelectElementMethod · 0.85
TestRemoveFromTreeFunction · 0.85

Calls 1

QueryFunction · 0.85

Tested by 15

ExampleFunction · 0.74
TestDefaultNamespace_1Function · 0.68
TestDefaultNamespace_2Function · 0.68
TestNamespaceURLFunction · 0.68
TestMissDeclarationFunction · 0.68
TestCharDataFunction · 0.68
TestLineNumbersFunction · 0.68
TestRemoveFromTreeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…