org.exolab.castor.xml
Class NamespacesStack

java.lang.Object
  extended by org.exolab.castor.xml.NamespacesStack

public class NamespacesStack
extends Object

This class is an actual namespace stack implementation, responsible for adding and removing namespace scopes, as well as resolving namespace urls and prefixes by traversing all the namespace stack.

Since:
1.3.3
Author:
Jakub Narloch

Constructor Summary
NamespacesStack()
           
 
Method Summary
 void addDefaultNamespace(String namespaceUri)
          Adds the default namespace to current scope.
 void addNamespace(String namespacePrefix, String namespaceUri)
          Adds a namespace to current scope.
 void addNewNamespaceScope()
          Adds a new namespace scope.
 void declareAsAttributes(AttributeListImpl attributeList, boolean localOnly)
          Declares the namespaces using the attribute list.
 Namespaces getCurrentNamespaceScope()
          Retrieves the current namespace scope.
 String getDefaultNamespaceURI()
          Retrieves the default namespace namespace uri.
 Enumeration<String> getLocalNamespacePrefixes()
          Retrieves the namespace prefixes registered in current scope.
 String getNamespacePrefix(String namespaceUri)
          Retrieves the namespace prefix for the given namespace uri.
 String getNamespaceURI(String namespacePrefix)
          Retrieves the namespace uri bound to specified prefix.
 String getNonDefaultNamespacePrefix(String namespaceUri)
          Retrieves the non default namespace prefix for the given namespace uri.
 void removeNamespace(String namespacePrefix)
          Removes the namespace from current scope using the namespace prefix
 void removeNamespaceScope()
          Removes the namespace scope.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamespacesStack

public NamespacesStack()
Method Detail

addNamespace

public void addNamespace(String namespacePrefix,
                         String namespaceUri)
Adds a namespace to current scope.

Parameters:
namespacePrefix - the namespace prefix
namespaceUri - the namespace uri

addDefaultNamespace

public void addDefaultNamespace(String namespaceUri)
Adds the default namespace to current scope.

Parameters:
namespaceUri - the namespace uri

removeNamespace

public void removeNamespace(String namespacePrefix)
Removes the namespace from current scope using the namespace prefix

Parameters:
namespacePrefix - the prefix of the namespace to remove

getNamespaceURI

public String getNamespaceURI(String namespacePrefix)
Retrieves the namespace uri bound to specified prefix.

Parameters:
namespacePrefix - the namespace prefix
Returns:
the namespace uri bound to the prefix, or null if no namespace has been bound for the given prefix

declareAsAttributes

public void declareAsAttributes(AttributeListImpl attributeList,
                                boolean localOnly)
Declares the namespaces using the attribute list.

Parameters:
attributeList - the list of attributes containing the namespaces
localOnly - whether the namespaces will only registered in current namespace context or in entire stack

getDefaultNamespaceURI

public String getDefaultNamespaceURI()
Retrieves the default namespace namespace uri.

Returns:
the default namespace uri

getNamespacePrefix

public String getNamespacePrefix(String namespaceUri)
Retrieves the namespace prefix for the given namespace uri.

Parameters:
namespaceUri - the namespace uri
Returns:
the

getNonDefaultNamespacePrefix

public String getNonDefaultNamespacePrefix(String namespaceUri)
Retrieves the non default namespace prefix for the given namespace uri.

Parameters:
namespaceUri - the namespace uri
Returns:
the

getLocalNamespacePrefixes

public Enumeration<String> getLocalNamespacePrefixes()
Retrieves the namespace prefixes registered in current scope.

Returns:
the enumeration of namespace prefixes

addNewNamespaceScope

public void addNewNamespaceScope()
Adds a new namespace scope.


removeNamespaceScope

public void removeNamespaceScope()
Removes the namespace scope.


getCurrentNamespaceScope

public Namespaces getCurrentNamespaceScope()
Retrieves the current namespace scope.

Returns:
the current namespace scope.


Copyright © 2013. All Rights Reserved.