Query searches the XML Node that matches by the specified XPath expr, and returns first matched element.
(top *Node, expr string)
| 96 | // Query searches the XML Node that matches by the specified XPath expr, |
| 97 | // and returns first matched element. |
| 98 | func Query(top *Node, expr string) (*Node, error) { |
| 99 | exp, err := getQuery(expr) |
| 100 | if err != nil { |
| 101 | return nil, err |
| 102 | } |
| 103 | return QuerySelector(top, exp), nil |
| 104 | } |
| 105 | |
| 106 | // QuerySelectorAll searches all of the XML Node that matches the specified |
| 107 | // XPath selectors. |
searching dependent graphs…