CompilePath creates an optimized version of an XPath-like string that can be used to query elements in an element tree.
(path string)
| 103 | // CompilePath creates an optimized version of an XPath-like string that |
| 104 | // can be used to query elements in an element tree. |
| 105 | func CompilePath(path string) (Path, error) { |
| 106 | var comp compiler |
| 107 | segments := comp.parsePath(path) |
| 108 | if comp.err != ErrPath("") { |
| 109 | return Path{nil}, comp.err |
| 110 | } |
| 111 | return Path{segments}, nil |
| 112 | } |
| 113 | |
| 114 | // MustCompilePath creates an optimized version of an XPath-like string that |
| 115 | // can be used to query elements in an element tree. Panics if an error |