final class NamespaceSupport.Context
extends java.lang.Object
This module caches and reuses Namespace contexts, so the number allocated will be equal to the element depth of the document, not to the total number of elements (i.e. 5-10 rather than tens of thousands). Also, data structures used to represent contexts are shared when possible (child contexts without declarations) to further reduce the amount of memory that's consumed.
Modifier and Type | Field and Description |
---|---|
(package private) java.util.Hashtable |
attributeNameTable |
private java.util.Vector |
declarations |
private boolean |
declSeen |
(package private) java.lang.String |
defaultNS |
(package private) java.util.Hashtable |
elementNameTable |
private NamespaceSupport.Context |
parent |
(package private) java.util.Hashtable |
prefixTable |
(package private) java.util.Hashtable |
uriTable |
Constructor and Description |
---|
Context()
Create the root-level Namespace context.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
clear()
Makes associated state become collectible,
invalidating this context.
|
private void |
copyTables()
Copy on write for the internal tables in this context.
|
(package private) void |
declarePrefix(java.lang.String prefix,
java.lang.String uri)
Declare a Namespace prefix for this context.
|
(package private) java.util.Enumeration |
getDeclaredPrefixes()
Return an enumeration of prefixes declared in this context.
|
(package private) java.lang.String |
getPrefix(java.lang.String uri)
Look up one of the prefixes associated with a URI in this context.
|
(package private) java.util.Enumeration |
getPrefixes()
Return an enumeration of all prefixes currently in force.
|
(package private) java.lang.String |
getURI(java.lang.String prefix)
Look up the URI associated with a prefix in this context.
|
(package private) java.lang.String[] |
processName(java.lang.String qName,
boolean isAttribute)
Process an XML qualified name in this context.
|
(package private) void |
setParent(NamespaceSupport.Context parent)
(Re)set the parent of this Namespace context.
|
java.util.Hashtable prefixTable
java.util.Hashtable uriTable
java.util.Hashtable elementNameTable
java.util.Hashtable attributeNameTable
java.lang.String defaultNS
private java.util.Vector declarations
private boolean declSeen
private NamespaceSupport.Context parent
void setParent(NamespaceSupport.Context parent)
context
- The parent Namespace context object.void clear()
setParent(com.sun.xml.txw2.NamespaceSupport.Context)
must be called before
this context may be used again.void declarePrefix(java.lang.String prefix, java.lang.String uri)
prefix
- The prefix to declare.uri
- The associated Namespace URI.NamespaceSupport.declarePrefix(java.lang.String, java.lang.String)
java.lang.String[] processName(java.lang.String qName, boolean isAttribute)
qName
- The XML qualified name.isAttribute
- true if this is an attribute name.NamespaceSupport.processName(java.lang.String, java.lang.String[], boolean)
java.lang.String getURI(java.lang.String prefix)
prefix
- The prefix to look up.NamespaceSupport.getURI(java.lang.String)
java.lang.String getPrefix(java.lang.String uri)
Since many prefixes may be mapped to the same URI, the return value may be unreliable.
uri
- The URI to look up.NamespaceSupport.getPrefix(java.lang.String)
java.util.Enumeration getDeclaredPrefixes()
NamespaceSupport.getDeclaredPrefixes()
java.util.Enumeration getPrefixes()
The default prefix, if in force, is not returned, and will have to be checked for separately.
NamespaceSupport.getPrefixes()
private void copyTables()
This class is optimized for the normal case where most elements do not contain Namespace declarations.