org.apache.xpath.domapi
Class XPathEvaluatorImpl.DummyPrefixResolver

java.lang.Object
  extended byorg.apache.xpath.domapi.XPathEvaluatorImpl.DummyPrefixResolver
All Implemented Interfaces:
PrefixResolver
Enclosing class:
XPathEvaluatorImpl

class XPathEvaluatorImpl.DummyPrefixResolver
extends Object
implements PrefixResolver

This prefix resolver is created whenever null is passed to the evaluate method. Its purpose is to satisfy the DOM L3 XPath API requirement that if a null prefix resolver is used, an exception should only be thrown when an attempt is made to resolve a prefix.


Constructor Summary
XPathEvaluatorImpl.DummyPrefixResolver()
          Constructor for DummyPrefixResolver.
 
Method Summary
 String getBaseIdentifier()
          Return the base identifier.
 String getNamespaceForPrefix(String prefix)
          Given a namespace, get the corrisponding prefix.
 String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context)
          Given a namespace, get the corresponding prefix, based on the context node.
 boolean handlesNullPrefixes()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathEvaluatorImpl.DummyPrefixResolver

public XPathEvaluatorImpl.DummyPrefixResolver()
Constructor for DummyPrefixResolver.

Method Detail

getNamespaceForPrefix

public String getNamespaceForPrefix(String prefix,
                                    org.w3c.dom.Node context)
Description copied from interface: PrefixResolver
Given a namespace, get the corresponding prefix, based on the context node.

Specified by:
getNamespaceForPrefix in interface PrefixResolver
Parameters:
prefix - The prefix to look up, which may be an empty string ("") for the default Namespace.
context - The node context from which to look up the URI.
Returns:
The associated Namespace URI as a string, or null if the prefix is undeclared in this context.
Throws:
org.w3c.dom.DOMException - NAMESPACE_ERR: Always throws this exceptionn
See Also:
PrefixResolver.getNamespaceForPrefix(String, Node)

getNamespaceForPrefix

public String getNamespaceForPrefix(String prefix)
Description copied from interface: PrefixResolver
Given a namespace, get the corrisponding prefix. This assumes that the PrefixResolver holds its own namespace context, or is a namespace context itself.

Specified by:
getNamespaceForPrefix in interface PrefixResolver
Parameters:
prefix - The prefix to look up, which may be an empty string ("") for the default Namespace.
Returns:
The associated Namespace URI, or null if the prefix is undeclared in this context.
Throws:
org.w3c.dom.DOMException - NAMESPACE_ERR: Always throws this exceptionn
See Also:
PrefixResolver.getNamespaceForPrefix(String)

handlesNullPrefixes

public boolean handlesNullPrefixes()
Specified by:
handlesNullPrefixes in interface PrefixResolver
See Also:
PrefixResolver.handlesNullPrefixes()

getBaseIdentifier

public String getBaseIdentifier()
Description copied from interface: PrefixResolver
Return the base identifier.

Specified by:
getBaseIdentifier in interface PrefixResolver
Returns:
The base identifier from where relative URIs should be absolutized, or null if the base ID is unknown.

CAVEAT: Note that the base URI in an XML document may vary with where you are in the document, if part of the doc's contents were brought in via an external entity reference or if mechanisms such as xml:base have been used. Unless this PrefixResolver is bound to a specific portion of the document, or has been kept up to date via some other mechanism, it may not accurately reflect that context information.

See Also:
PrefixResolver.getBaseIdentifier()