Re: DOM 3 XPath: Implementation Questions

 > * XPathNSResolver: MUST be bound to Node, or not?

Not. We provide a convenience function which creates one standard version
based on a context node, but users can plug in their own implementations if
they want to derive the data from some other source such as an
application-specific list.  Some existing XPath implementations, such as
Xalan, offer the same option: Wrap a convenience implementation around a
DOM node, if you have a DOM node, or provide your own.

> * XPathExpression: NSResolver at create time vs. at evaluate time
>
> What is intended by the fact that, for XPathExpression, the
XPathNSResolver
> is specified at XPathExpression creation time, rather than at
> XPathExpression.evaluate time?

XPath is namespace-aware. The meaning of an XPath depends on how prefixes
used in the XPath are bound. If you're doing any sort of
compilation/optimization in the process of creating the XPathExpression
object, you want to do that binding early, during the compilation process.

There really isn't a good justification, in my opinion, for late binding of
those prefixes; if anything, that would tend to defeat the namespace-aware
semantics of the XPath.

______________________________________
Joe Kesselman  / IBM Research

Received on Thursday, 16 May 2002 09:10:37 UTC