Class NamespaceContextImpl

  • All Implemented Interfaces:
    NamespaceContext

    public class NamespaceContextImpl
    extends Object
    implements NamespaceContext
    Mappings between prefix strings and namespace URI strings, as required to perform XPath queries on namespaced XML documents.
    Author:
    jmurty
    • Constructor Detail

      • NamespaceContextImpl

        public NamespaceContextImpl()
        Create an empty namespace context.
      • NamespaceContextImpl

        public NamespaceContextImpl​(Element element)
        Create a namespace context that will lookup namespace information in the given element.
        Parameters:
        element - Element in which to look up namespace information.
    • Method Detail

      • addNamespace

        public void addNamespace​(String prefix,
                                 String namespaceURI)
        Add a custom mapping from prefix to a namespace. This mapping will override any mappings present in this class's XML Element (if provided).
        Parameters:
        prefix - the namespace's prefix. Use an empty string for the default prefix.
        namespaceURI - the namespace URI to map.