QueryAll searches the html.Node that matches by the specified XPath expr. Return an error if the expression `expr` cannot be parsed.
(top *html.Node, expr string)
| 49 | // QueryAll searches the html.Node that matches by the specified XPath expr. |
| 50 | // Return an error if the expression `expr` cannot be parsed. |
| 51 | func QueryAll(top *html.Node, expr string) ([]*html.Node, error) { |
| 52 | exp, err := getQuery(expr) |
| 53 | if err != nil { |
| 54 | return nil, err |
| 55 | } |
| 56 | nodes := QuerySelectorAll(top, exp) |
| 57 | return nodes, nil |
| 58 | } |
| 59 | |
| 60 | // Query runs the given XPath expression against the given html.Node and |
| 61 | // returns the first matching html.Node, or nil if no matches are found. |
no test coverage detected
searching dependent graphs…