Kohsuke KAWAGUCHI wrote:
>
> Hi,
>
> I'm trying to use XPath classes in my application, and several questions
> occur to me.
>
> 1. Why the execute method needs a PrefixResolver as a parameter? When
> is it used? I can understand that the constructor need it because it
> is necessary to compile XPath expressions like "foo:bar", but why
> does the execute method need it?
It is used to determine namespaces in the input document at run time.
Normally, it would point to the context node but this gives you the
flexibility to allow the prefixes in your input document to resolve to
anything you decide.
>
> 2. Is XPath object thread-safe? In other words, can multiple threads
> safely call the execute method of the same XPath object? A
> documentation in the Expression class says "Expressions are immutable",
> so XPath object looks like thread-safe, too.
>
> However, there is another documentation in the XPathAPI.eval method
> that suggests otherwise.
XPath should be thread-safe. I think the thread safety comment in
XPathAPI refers to XPathContext() not being thread-safe rather than the
XPath class itself.
>
> regards,
> --
> Kohsuke KAWAGUCHI +1 650 786 0721
> Sun Microsystems [EMAIL PROTECTED]
Gary