On Monday 17 Mar 2003 11:38, Eric Anderson wrote:
> On Mon, 2003-03-17 at 06:15, Peter Robins wrote:
> > replace 'find' with 'evaluate' (or 'match') and 'getText' with
> > 'getData' and that should do what you're looking for (though you
> > might want to change your location path to e.g. //tag to fetch
> > all the descendant nodes)
>
> But according to the documentation and my experience with the
> library, 'evaluate' and 'match' will only resolve a XPathQuery if
> it resolves to one node. If it resolves to a collection of nodes
> (or no nodes), then an error is generated.
not on the copy I have!
from the documentation for match:
"Matches (evaluates) an XPath query . . .
Return Value: The result of the XPath expression. Either: node-set (an
ordered collection of nodes without duplicates) . . ."
Though it doesn't actually say so, what it returns is an array of
paths, which you can then use in your for loop (or whatever) to
getData (or whatever). So in your example //tag will return
/root[1]/tag[1]
/root[1]/tag[2]
/root[1]/tag[3]
|