public class NamespaceContextImpl extends Object implements NamespaceContext
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 and Description |
|---|
NamespaceContextImpl(Node node)
Creates a new NamespaceContext using mappings from an existing node
in some document.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNamespaceMapping(String prefix,
String namespaceURI)
Add a namespace mapping this namespace context.
|
String |
getNamespaceURI(String prefix) |
String |
getPrefix(String namespaceURI) |
Iterator<String> |
getPrefixes(String namespaceURI) |
public NamespaceContextImpl(Node node)
node - a node to use the in-scope namespace mappings from;
if null then no namespace mappings are defined.public String getNamespaceURI(String prefix)
getNamespaceURI in interface NamespaceContextpublic String getPrefix(String namespaceURI)
getPrefix in interface NamespaceContextpublic Iterator<String> getPrefixes(String namespaceURI)
getPrefixes in interface NamespaceContextpublic void addNamespaceMapping(String prefix, String namespaceURI)
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.
prefix - Namespace prefix, empty string for default mapping
namespace.namespaceURI - Namespace URI associated with the prefix.Copyright © 2010 - 2020 Adobe. All Rights Reserved