Class NamespaceResolver

java.lang.Object
org.apache.commons.jxpath.ri.NamespaceResolver
All Implemented Interfaces:
Serializable, Cloneable

public class NamespaceResolver extends Object implements Cloneable, Serializable
Namespace resolver for JXPathContextReferenceImpl.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getPrefix

      protected static String getPrefix(NodePointer pointer, String namespaceURI)
      Find the namespace prefix for the specified namespace URI and NodePointer.
      Parameters:
      pointer - location
      namespaceURI - to check
      Returns:
      prefix if found
      Since:
      JXPath 1.3
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • getExternallyRegisteredNamespaceURI

      Given a prefix, returns an externally registered namespace URI.
      Parameters:
      prefix - The namespace prefix to look up
      Returns:
      namespace URI or null if the prefix is undefined.
      Since:
      JXPath 1.3
    • getExternallyRegisteredPrefix

      protected String getExternallyRegisteredPrefix(String namespaceURI)
      Gets the nearest prefix found that matches an externally-registered namespace.
      Parameters:
      namespaceURI - the ns URI to check.
      Returns:
      String prefix if found.
      Since:
      JXPath 1.3
    • getNamespaceContextPointer

      Gets the namespace context pointer.
      Returns:
      Pointer
    • getNamespaceURI

      public String getNamespaceURI(String prefix)
      Given a prefix, returns a registered namespace URI. If the requested prefix was not defined explicitly using the registerNamespace method, JXPathContext will then check the context node to see if the prefix is defined there. See setNamespaceContextPointer.
      Parameters:
      prefix - The namespace prefix to look up
      Returns:
      namespace URI or null if the prefix is undefined.
    • getPrefix

      public String getPrefix(String namespaceURI)
      Gets the prefix associated with the specifed namespace URI.
      Parameters:
      namespaceURI - the ns URI to check.
      Returns:
      String prefix
    • isSealed

      public boolean isSealed()
      Tests whether this NamespaceResolver has been sealed.
      Returns:
      boolean
    • registerNamespace

      public void registerNamespace(String prefix, String namespaceURI)
      Registers a namespace prefix.
      Parameters:
      prefix - A namespace prefix
      namespaceURI - A URI for that prefix
    • seal

      public void seal()
    • setNamespaceContextPointer

      public void setNamespaceContextPointer(NodePointer pointer)
      Register a namespace for the expression context.
      Parameters:
      pointer - the Pointer to set.