MCPcopy Create free account
hub / github.com/beevik/etree / MustCompilePath

Function MustCompilePath

path.go:118–124  ·  view source on GitHub ↗

MustCompilePath creates an optimized version of an XPath-like string that can be used to query elements in an element tree. Panics if an error occurs. Use this function to create Paths when you know the path is valid (i.e., if it's hard-coded).

(path string)

Source from the content-addressed store, hash-verified

116// occurs. Use this function to create Paths when you know the path is
117// valid (i.e., if it's hard-coded).
118func MustCompilePath(path string) Path {
119 p, err := CompilePath(path)
120 if err != nil {
121 panic(err)
122 }
123 return p
124}
125
126// traverse follows the path from the element e, yielding elements that match
127// the path's selectors and filters using iterators.

Callers 3

TestFindElementsSeqFunction · 0.85
FindElementMethod · 0.85
FindElementsSeqMethod · 0.85

Calls 1

CompilePathFunction · 0.85

Tested by 1

TestFindElementsSeqFunction · 0.68