Class NamespaceContextImpl

java.lang.Object
com.adobe.xfa.dom.NamespaceContextImpl
All Implemented Interfaces:
NamespaceContext

public class NamespaceContextImpl extends Object implements NamespaceContext
Implements the interface javax.xml.namespace.NamespaceContext using the namespace prefix mapping in scope from an existing Node.

Normally, the namespace prefixes mappings in an XPath expression are unrelated to any namespace mappings in the XML document, but this implementation uses the existing in-scope namespace mappings from some node in the document to define a set of mappings.

Additional mappings can be added explicitly.

  • Constructor Details

    • NamespaceContextImpl

      public NamespaceContextImpl(Node node)
      Creates a new NamespaceContext using mappings from an existing node in some document.
      Parameters:
      node - a node to use the in-scope namespace mappings from; if null then no namespace mappings are defined.
  • Method Details

    • getNamespaceURI

      public String getNamespaceURI(String prefix)
      Specified by:
      getNamespaceURI in interface NamespaceContext
    • getPrefix

      public String getPrefix(String namespaceURI)
      Specified by:
      getPrefix in interface NamespaceContext
    • getPrefixes

      public Iterator<String> getPrefixes(String namespaceURI)
      Specified by:
      getPrefixes in interface NamespaceContext
    • addNamespaceMapping

      public void addNamespaceMapping(String prefix, String namespaceURI)
      Add a namespace mapping this namespace context.

      Additional namespace mappings can be added to this NamespaceContext -- mappings which aren't expressed anywhere in the document's elements.

      Mappings provided through this method will be used only as a last resort. If an element's mapping redefines either the prefix or namespace URI given in this call, the element's definition will take precedence for it and its descendants.

      Parameters:
      prefix - Namespace prefix, empty string for default mapping namespace.
      namespaceURI - Namespace URI associated with the prefix.