Could you please explain further.

The PrefixResolver interface supports two flavors of getNamespaceForPrefix.
The javadoc, which incorrectly describes these functions as determining
prefixes from namespace URIs, rather than the opposite, claims that an
implementation can specify how to get the default namespace Uri from the
empty string prefix.  The docs do not explain how the PrefixResolver is
used.  Is the PrefixResolver called on things it finds in the XPath
expression, or on the source tree data, or both?  Clearly the implementation
depends upon the answer to this question.  If the PrefixResolver is used on
parts of the XPath expression, an arbitrary prefix can be used there to
represent the default namespace.  If it's used on the source tree, the
implementation must deal with the empty string prefix, and possibly also the
null prefix, depending upon how the source node prefix is obtained and
represented.  (E.g., Node.getPrefix() returns null in the Xerces 2.1.0 DOM).

It appears that only one of the XPathAPI methods (one flavor of eval) can
take a PrefixResolver -- the selectXXX methods cannot.

Jeff

----- Original Message -----
From: "David N Bertoni/Cambridge/IBM" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 26, 2002 5:10 PM
Subject: Re: xpath constructor


> There is no need to alter the input document, and the FAQ is not
suggesting
> you do that.  Since XPath is meant to be embedded in other specifications,
> it relies on those specifications to provide a context for the evaluation
> of expressions.  One part of that context is a set of namespace
> declarations that map prefixes to namespace URIs.  In the XSLT
environment,
> that would be the stylesheet document that contains the XPaths.  In a
> stand-alone environment like Xalan's XPathAPI, you must implement the
> interface org.apache.xml.utils.PrefixResolver.  Then, you can use a prefix
> in your name tests and bind it to the appropriate namespace URI.

Reply via email to