QuerySelector returns the first matched html.Node by the specified XPath selector.
(top *html.Node, selector *xpath.Expr)
| 71 | |
| 72 | // QuerySelector returns the first matched html.Node by the specified XPath selector. |
| 73 | func QuerySelector(top *html.Node, selector *xpath.Expr) *html.Node { |
| 74 | t := selector.Select(CreateXPathNavigator(top)) |
| 75 | if t.MoveNext() { |
| 76 | return getCurrentNode(t.Current().(*NodeNavigator)) |
| 77 | } |
| 78 | return nil |
| 79 | } |
| 80 | |
| 81 | // QuerySelectorAll searches all of the html.Node that matches the specified XPath selectors. |
| 82 | func QuerySelectorAll(top *html.Node, selector *xpath.Expr) []*html.Node { |
no test coverage detected
searching dependent graphs…