public final class Namespaces extends Object
Modifier and Type | Field and Description |
---|---|
static String |
XML_NAMESPACE
The reserved XML 1.0 Namespace URI
|
static String |
XML_NAMESPACE_PREFIX
The reserved XML Namespace Prefix
|
Constructor and Description |
---|
Namespaces()
Creates a new Namespaces instance
|
Namespaces(Namespaces parent)
Creates a new Namespaces instance
|
Modifier and Type | Method and Description |
---|---|
void |
addNamespace(String prefix,
String uri)
Adds the given namespace declaration to this Namespaces
|
Namespaces |
createNamespaces()
Creates a new Namespaces instance with this Namespaces as the parent
|
void |
declareAsAttributes(org.xml.sax.helpers.AttributeListImpl atts,
boolean localOnly)
Declare the namespaces of this stack in as attributes.
|
Enumeration |
getLocalNamespacePrefixes()
Returns all namespace prefixes declared locally
|
Enumeration |
getLocalNamespaces()
Returns an Enumeration of local namespace URIs for this Namespaces.
|
String |
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.
|
String |
getNamespaceURI(String prefix)
Returns the Namespace URI associated with the given prefix
|
String |
getNonDefaultNamespacePrefix(String nsURI)
Returns the Namespace prefix associated with the given URI.
|
Namespaces |
getParent()
Returns the parent Namespaces for this Namespaces instance.
|
boolean |
removeNamespace(String prefix)
Removes the namespace declaration for the given prefix.
|
void |
sendEndEvents(ContentHandler handler)
Calls the given ContentHandler's endPrefixMapping method
for each locally declared namespace
|
void |
sendStartEvents(ContentHandler handler)
Calls the given ContentHandler's startPrefixMapping method
for each locally declared namespace
|
void |
setParent(Namespaces namespaces)
Sets the parent Namespaces for this Namespaces instance.
|
public static final String XML_NAMESPACE_PREFIX
public static final String XML_NAMESPACE
public Namespaces()
public Namespaces(Namespaces parent)
public void addNamespace(String prefix, String uri)
prefix
- the namespace prefixuri
- the namespace URI to be associated with the given prefixpublic Namespaces createNamespaces()
public Enumeration getLocalNamespaces()
public String getNamespaceURI(String prefix)
prefix
- the namespace prefix to lookuppublic String getNamespacePrefix(String nsURI)
#getNamespacePrefixes
.nsURI
- the namespace URI to lookuppublic Enumeration getLocalNamespacePrefixes()
public String[] getNamespacePrefixes(String nsURI)
nsURI
- the namespace URI to lookuppublic String[] getNamespacePrefixes(String nsURI, boolean local)
nsURI
- the namespace URI to lookuplocal
- a boolean that when true indicates only the local
scope is searched.public String getNonDefaultNamespacePrefix(String nsURI)
nsURI
- the namespace URI to lookuppublic Namespaces getParent()
public boolean removeNamespace(String prefix)
prefix
- the namespace prefix to remove the binding ofpublic void setParent(Namespaces namespaces)
namespaces
- the parent Namespacespublic void sendEndEvents(ContentHandler handler) throws SAXException
handler
- the ContentHandlerSAXException
public void sendStartEvents(ContentHandler handler) throws SAXException
handler
- the ContentHandlerSAXException
public void declareAsAttributes(org.xml.sax.helpers.AttributeListImpl atts, boolean localOnly)
atts
- the Attribute List to fill in.Copyright © 2016. All rights reserved.