Class PrefixResolverDefault

  • All Implemented Interfaces:
    PrefixResolver

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

      Constructors 
      Constructor Description
      PrefixResolverDefault​(org.w3c.dom.Node xpathExpressionContext)
      Construct a PrefixResolverDefault object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getBaseIdentifier()
      Return the base identifier.
      java.lang.String getNamespaceForPrefix​(java.lang.String prefix)
      Given a namespace, get the corrisponding prefix.
      java.lang.String getNamespaceForPrefix​(java.lang.String prefix, org.w3c.dom.Node namespaceContext)
      Given a namespace, get the corrisponding prefix.
      boolean handlesNullPrefixes()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrefixResolverDefault

        public PrefixResolverDefault​(org.w3c.dom.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 Detail

      • getNamespaceForPrefix

        public java.lang.String getNamespaceForPrefix​(java.lang.String prefix)
        Given a namespace, get the corrisponding prefix. This assumes that the PrevixResolver hold's it's own namespace context, or is a namespace context itself.
        Specified by:
        getNamespaceForPrefix in interface PrefixResolver
        Parameters:
        prefix - Prefix to resolve.
        Returns:
        Namespace that prefix resolves to, or null if prefix is not bound.
      • getNamespaceForPrefix

        public java.lang.String getNamespaceForPrefix​(java.lang.String prefix,
                                                      org.w3c.dom.Node namespaceContext)
        Given a namespace, get the corrisponding prefix. Warning: This will not work correctly if namespaceContext is an attribute node.
        Specified by:
        getNamespaceForPrefix in interface PrefixResolver
        Parameters:
        prefix - Prefix to resolve.
        namespaceContext - Node from which to start searching for a xmlns attribute that binds a prefix to a namespace.
        Returns:
        Namespace that prefix resolves to, or null if prefix is not bound.
      • getBaseIdentifier

        public java.lang.String getBaseIdentifier()
        Return the base identifier.
        Specified by:
        getBaseIdentifier in interface PrefixResolver
        Returns:
        null