public final class XmlSchemaNamespaceContext extends java.lang.Object implements NamespacePrefixList
NamespaceContext.
Implemented as a series of scope-based stacks, one per prefix.
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
namespacesByPrefixStack |
| Constructor and Description |
|---|
XmlSchemaNamespaceContext()
Constructs a new
XmlSchemaNamespaceContext with the
following initial mappings:
xml -> http://www.w3.org/1999/namespace
xmlns -> http://www.w3.org/2000/xmlns/
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNamespace(java.lang.String prefix,
java.lang.String namespaceUri)
Adds a new prefix mapping to the context.
|
void |
clear()
Clears the given namespace stack, restoring it to the original mappings
defined by the constructor.
|
java.lang.String[] |
getDeclaredPrefixes()
Returns the list of currently defined namespace prefixes.
|
java.lang.String |
getNamespaceURI(java.lang.String prefix) |
java.lang.String |
getPrefix(java.lang.String namespaceUri) |
java.util.Iterator |
getPrefixes(java.lang.String namespaceUri) |
private static boolean |
isRecognizedPrefix(java.lang.String prefix) |
void |
removeNamespace(java.lang.String prefix)
Removes the most recent prefix-to-namespace mapping for the provided
prefix.
|
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> namespacesByPrefixStack
public XmlSchemaNamespaceContext()
XmlSchemaNamespaceContext with the
following initial mappings:
xml -> http://www.w3.org/1999/namespacexmlns -> http://www.w3.org/2000/xmlns/public java.lang.String getNamespaceURI(java.lang.String prefix)
getNamespaceURI in interface javax.xml.namespace.NamespaceContextNamespaceContext.getNamespaceURI(String)public java.lang.String getPrefix(java.lang.String namespaceUri)
getPrefix in interface javax.xml.namespace.NamespaceContextNamespaceContext.getPrefix(String)public java.util.Iterator getPrefixes(java.lang.String namespaceUri)
getPrefixes in interface javax.xml.namespace.NamespaceContextNamespaceContext.getPrefixes(String)public java.lang.String[] getDeclaredPrefixes()
NamespacePrefixListgetDeclaredPrefixes in interface NamespacePrefixListNamespacePrefixList.getDeclaredPrefixes()public void addNamespace(java.lang.String prefix,
java.lang.String namespaceUri)
prefix - The prefix to represent the namespace URI.namespaceUri - the namespace URI represented by the prefix.java.lang.IllegalArgumentException - if the prefix is null, or if the
namespace URI is null or empty.public void removeNamespace(java.lang.String prefix)
prefix - The prefix to remove the current prefix-to-namespace
mapping of.java.lang.IllegalStateException - If there is no current mapping for that
prefix.public void clear()
private static boolean isRecognizedPrefix(java.lang.String prefix)