Class XmlSchemaNamespaceContext
java.lang.Object
org.apache.ws.commons.schema.docpath.XmlSchemaNamespaceContext
- All Implemented Interfaces:
NamespaceContext,NamespacePrefixList
A
NamespaceContext.
Implemented as a series of scope-based stacks, one per prefix.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newXmlSchemaNamespaceContextwith the following initial mappings:xml->http://www.w3.org/1999/namespacexmlns->http://www.w3.org/2000/xmlns/ -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNamespace(String prefix, String namespaceUri) Adds a new prefix mapping to the context.voidclear()Clears the given namespace stack, restoring it to the original mappings defined by the constructor.String[]Returns the list of currently defined namespace prefixes.getNamespaceURI(String prefix) getPrefixes(String namespaceUri) private static booleanisRecognizedPrefix(String prefix) voidremoveNamespace(String prefix) Removes the most recent prefix-to-namespace mapping for the provided prefix.
-
Field Details
-
namespacesByPrefixStack
-
-
Constructor Details
-
XmlSchemaNamespaceContext
public XmlSchemaNamespaceContext()Constructs a newXmlSchemaNamespaceContextwith the following initial mappings:-
xml->http://www.w3.org/1999/namespace -
xmlns->http://www.w3.org/2000/xmlns/
-
-
-
Method Details
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceNamespaceContext- See Also:
-
getPrefix
- Specified by:
getPrefixin interfaceNamespaceContext- See Also:
-
getPrefixes
- Specified by:
getPrefixesin interfaceNamespaceContext- See Also:
-
getDeclaredPrefixes
Description copied from interface:NamespacePrefixListReturns the list of currently defined namespace prefixes.- Specified by:
getDeclaredPrefixesin interfaceNamespacePrefixList- See Also:
-
addNamespace
Adds a new prefix mapping to the context. The prefix may be an empty string to represent the default namespace, but it cannot be null. The namespace URI can never be empty or null.- Parameters:
prefix- The prefix to represent the namespace URI.namespaceUri- the namespace URI represented by the prefix.- Throws:
IllegalArgumentException- if the prefix is null, or if the namespace URI is null or empty.
-
removeNamespace
Removes the most recent prefix-to-namespace mapping for the provided prefix. The prior prefix-to-namespace mapping before it is restored.- Parameters:
prefix- The prefix to remove the current prefix-to-namespace mapping of.- Throws:
IllegalStateException- If there is no current mapping for that prefix.
-
clear
public void clear()Clears the given namespace stack, restoring it to the original mappings defined by the constructor. -
isRecognizedPrefix
-