Beispiel #1
0
//FromReader runs an XPath expression on the XML reader
func FromReader(xpath string, r io.Reader) ([]pathres.PathRes, error) {
	it := lexer.Lex(xpath)
	p, err := parser.CreateParser(r)

	if err != nil {
		return nil, err
	}

	return p.Parse(it)
}
Beispiel #2
0
//FromStr runs an XPath expression on the XML string
func FromStr(xpath, x string) ([]pathres.PathRes, error) {
	it := lexer.Lex(xpath)
	p, err := parser.CreateParserStr(x)

	if err != nil {
		return nil, err
	}

	return p.Parse(it)
}