Class PrefixResolverDefault
java.lang.Object
org.loboevolution.apache.xml.utils.PrefixResolverDefault
- All Implemented Interfaces:
PrefixResolver
This class implements a generic PrefixResolver that can be used to perform prefix-to-namespace
lookup for the XPath object.
-
Constructor Summary
ConstructorDescriptionPrefixResolverDefault
(Node xpathExpressionContext) Construct a PrefixResolverDefault object. -
Method Summary
Modifier and TypeMethodDescriptiongetNamespaceForPrefix
(String prefix) Given a namespace, get the corresponding prefix.getNamespaceForPrefix
(String prefix, Node namespaceContext) Given a namespace, get the corresponding prefix, based on the context node.boolean
-
Constructor Details
-
PrefixResolverDefault
Construct a PrefixResolverDefault object.- Parameters:
xpathExpressionContext
- The context from which XPath expression prefixes will be resolved. Warning: This will not work correctly if xpathExpressionContext is an attribute node.
-
-
Method Details
-
getNamespaceForPrefix
Given a namespace, get the corresponding prefix. This assumes that the PrefixResolver holds its own namespace context, or is a namespace context itself.- Specified by:
getNamespaceForPrefix
in interfacePrefixResolver
- 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.
-
getNamespaceForPrefix
Given a namespace, get the corresponding prefix, based on the context node.- Specified by:
getNamespaceForPrefix
in interfacePrefixResolver
- Parameters:
prefix
- The prefix to look up, which may be an empty string ("") for the default Namespace.namespaceContext
- 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.
-
handlesNullPrefixes
public boolean handlesNullPrefixes()- Specified by:
handlesNullPrefixes
in interfacePrefixResolver
-