Class PrefixResolverDefault

java.lang.Object
org.loboevolution.apache.xml.utils.PrefixResolverDefault
All Implemented Interfaces:
PrefixResolver

public class PrefixResolverDefault extends Object implements PrefixResolver
This class implements a generic PrefixResolver that can be used to perform prefix-to-namespace lookup for the XPath object.
  • Constructor Details

    • PrefixResolverDefault

      public PrefixResolverDefault(Node xpathExpressionContext)
      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

      public String getNamespaceForPrefix(String prefix)
      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 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.
    • getNamespaceForPrefix

      public String getNamespaceForPrefix(String prefix, Node namespaceContext)
      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.
      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 interface PrefixResolver