Class Namespaces
java.lang.Object
org.exolab.adaptx.xslt.util.Namespaces
A class for handling Namespace declaration and scoping
- Version:
- $Revision: 4031 $ $Date: 2003-12-22 20:45:49 +0100 (Mon, 22 Dec 2003) $
- Author:
- Keith Visco
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Namespaces instanceNamespaces(Namespaces parent) Creates a new Namespaces instance -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNamespace(String prefix, String uri) Adds the given namespace declaration to this NamespacesCreates a new Namespaces instance with this Namespaces as the parentvoiddeclareAsAttributes(AttributeListImpl atts, boolean localOnly) Declare the namespaces of this stack in as attributes.Returns all namespace prefixes declared locallyReturns an Enumeration of local namespace URIs for this Namespaces.getNamespacePrefix(String nsURI) Returns the Namespace prefix associated with the given URI.String[]getNamespacePrefixes(String nsURI) Returns all namespace prefixes associated with the given URI, including those from parent scopes.String[]getNamespacePrefixes(String nsURI, boolean local) Returns the Namespace prefixes associated with the given URI.getNamespaceURI(String prefix) Returns the Namespace URI associated with the given prefixReturns the Namespace prefix associated with the given URI.Returns the parent Namespaces for this Namespaces instance.booleanremoveNamespace(String prefix) Removes the namespace declaration for the given prefix.voidsetParent(Namespaces namespaces) Sets the parent Namespaces for this Namespaces instance.
-
Field Details
-
XML_NAMESPACE_PREFIX
-
XML_NAMESPACE
-
-
Constructor Details
-
Namespaces
public Namespaces()Creates a new Namespaces instance -
Namespaces
Creates a new Namespaces instance
-
-
Method Details
-
addNamespace
-
createNamespaces
Creates a new Namespaces instance with this Namespaces as the parent -
getLocalNamespaces
Returns an Enumeration of local namespace URIs for this Namespaces.- Returns:
- an Enumeration of local namespace URIs.
-
getNamespaceURI
-
getNamespacePrefix
Returns the Namespace prefix associated with the given URI. If multiple namespace prefixes have been declared, then the first one found is returned. To obtain all prefixes see#getNamespacePrefixes.- Parameters:
nsURI- the namespace URI to lookup- Returns:
- the namespace prefix associated with the given URI
-
getLocalNamespacePrefixes
Returns all namespace prefixes declared locally- Returns:
- an Enumeration of locally declared namespace prefixes
-
getNamespacePrefixes
-
getNamespacePrefixes
Returns the Namespace prefixes associated with the given URI.- Parameters:
nsURI- the namespace URI to lookuplocal- a boolean that when true indicates only the local scope is searched.- Returns:
- the namespace prefixes associated with the given URI
-
getNonDefaultNamespacePrefix
Returns the Namespace prefix associated with the given URI. Or null if no prefix has been declared. This method will ignore the default namespace. This is useful when dealing with attributes that do not use the default namespace.- Parameters:
nsURI- the namespace URI to lookup- Returns:
- the namespace prefix associated with the given URI
-
getParent
Returns the parent Namespaces for this Namespaces instance.- Returns:
- the parent Namespaces for this Namespaces instance.
-
removeNamespace
Removes the namespace declaration for the given prefix. This is a local action only, the namespace declaration will not be removed from any parent Namespaces object.- Parameters:
prefix- the namespace prefix to remove the binding of- Returns:
- true if the namespace declaration was removed, otherwise false.
-
setParent
Sets the parent Namespaces for this Namespaces instance.- Parameters:
namespaces- the parent Namespaces
-
declareAsAttributes
Declare the namespaces of this stack in as attributes.- Parameters:
atts- the Attribute List to fill in.
-