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)
| 116 | // occurs. Use this function to create Paths when you know the path is |
| 117 | // valid (i.e., if it's hard-coded). |
| 118 | func 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. |