Package org.exolab.castor.xml
Class NamespacesStack
java.lang.Object
org.exolab.castor.xml.NamespacesStack
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDefaultNamespace
(String namespaceUri) Adds the default namespace to current scope.void
addNamespace
(String namespacePrefix, String namespaceUri) Adds a namespace to current scope.void
Adds a new namespace scope.void
declareAsAttributes
(AttributeListImpl attributeList, boolean localOnly) Declares the namespaces using the attribute list.Retrieves the current namespace scope.Retrieves the default namespace namespace uri.Retrieves the namespace prefixes registered in current scope.getNamespacePrefix
(String namespaceUri) Retrieves the namespace prefix for the given namespace uri.getNamespaceURI
(String namespacePrefix) Retrieves the namespace uri bound to specified prefix.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 prefixvoid
Removes the namespace scope.
-
Constructor Details
-
NamespacesStack
public NamespacesStack()
-
-
Method Details
-
addNamespace
Adds a namespace to current scope.- Parameters:
namespacePrefix
- the namespace prefixnamespaceUri
- the namespace uri
-
addDefaultNamespace
Adds the default namespace to current scope.- Parameters:
namespaceUri
- the namespace uri
-
removeNamespace
Removes the namespace from current scope using the namespace prefix- Parameters:
namespacePrefix
- the prefix of the namespace to remove
-
getNamespaceURI
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
Declares the namespaces using the attribute list.- Parameters:
attributeList
- the list of attributes containing the namespaceslocalOnly
- whether the namespaces will only registered in current namespace context or in entire stack
-
getDefaultNamespaceURI
Retrieves the default namespace namespace uri.- Returns:
- the default namespace uri
-
getNamespacePrefix
Retrieves the namespace prefix for the given namespace uri.- Parameters:
namespaceUri
- the namespace uri- Returns:
- the
-
getNonDefaultNamespacePrefix
Retrieves the non default namespace prefix for the given namespace uri.- Parameters:
namespaceUri
- the namespace uri- Returns:
- the
-
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
Retrieves the current namespace scope.- Returns:
- the current namespace scope.
-