org.apache.ws.commons.schema.docpath
Class XmlSchemaNamespaceContext

java.lang.Object
  extended by org.apache.ws.commons.schema.docpath.XmlSchemaNamespaceContext
All Implemented Interfaces:
NamespaceContext, NamespacePrefixList

public final class XmlSchemaNamespaceContext
extends Object
implements NamespacePrefixList

A NamespaceContext.

Implemented as a series of scope-based stacks, one per prefix.


Constructor Summary
XmlSchemaNamespaceContext()
          Constructs a new XmlSchemaNamespaceContext with the following initial mappings: xml -> http://www.w3.org/1999/namespace xmlns -> http://www.w3.org/2000/xmlns/
 
Method Summary
 void addNamespace(String prefix, 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.
 String[] getDeclaredPrefixes()
           
 String getNamespaceURI(String prefix)
           
 String getPrefix(String namespaceUri)
           
 Iterator getPrefixes(String namespaceUri)
           
 void removeNamespace(String prefix)
          Removes the most recent prefix-to-namespace mapping for the provided prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlSchemaNamespaceContext

public XmlSchemaNamespaceContext()
Constructs a new XmlSchemaNamespaceContext with the following initial mappings:

Method Detail

getNamespaceURI

public String getNamespaceURI(String prefix)
Specified by:
getNamespaceURI in interface NamespaceContext
See Also:
NamespaceContext.getNamespaceURI(String)

getPrefix

public String getPrefix(String namespaceUri)
Specified by:
getPrefix in interface NamespaceContext
See Also:
NamespaceContext.getPrefix(String)

getPrefixes

public Iterator getPrefixes(String namespaceUri)
Specified by:
getPrefixes in interface NamespaceContext
See Also:
NamespaceContext.getPrefixes(String)

getDeclaredPrefixes

public String[] getDeclaredPrefixes()
Specified by:
getDeclaredPrefixes in interface NamespacePrefixList
See Also:
NamespacePrefixList.getDeclaredPrefixes()

addNamespace

public void addNamespace(String prefix,
                         String namespaceUri)
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

public void removeNamespace(String prefix)
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.



Copyright © 2004-2015 The Apache Software Foundation. All Rights Reserved.