|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.utils.Context2
Internal class for a single Namespace context.
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).
Field Summary | |
(package private) Hashtable |
attributeNameTable
|
private Context2 |
child
|
private Vector |
declarations
|
(package private) String |
defaultNS
|
(package private) Hashtable |
elementNameTable
|
private static Enumeration |
EMPTY_ENUMERATION
An empty enumeration. |
private Context2 |
parent
|
(package private) Hashtable |
prefixTable
|
private boolean |
tablesDirty
|
(package private) Hashtable |
uriTable
|
Constructor Summary | |
(package private) |
Context2(Context2 parent)
Create a new Namespace context. |
Method Summary | |
private void |
copyTables()
Copy on write for the internal tables in this context. |
(package private) void |
declarePrefix(String prefix,
String uri)
Declare a Namespace prefix for this context. |
(package private) Context2 |
getChild()
|
(package private) Enumeration |
getDeclaredPrefixes()
Return an enumeration of prefixes declared in this context. |
(package private) Context2 |
getParent()
|
(package private) String |
getPrefix(String uri)
Look up one of the prefixes associated with a URI in this context. |
(package private) Enumeration |
getPrefixes()
Return an enumeration of all prefixes currently in force. |
(package private) String |
getURI(String prefix)
Look up the URI associated with a prefix in this context. |
(package private) String[] |
processName(String qName,
boolean isAttribute)
Process a raw XML 1.0 name in this context. |
(package private) void |
setParent(Context2 parent)
(Re)set the parent of this Namespace context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Enumeration EMPTY_ENUMERATION
Hashtable prefixTable
Hashtable uriTable
Hashtable elementNameTable
Hashtable attributeNameTable
String defaultNS
private Vector declarations
private boolean tablesDirty
private Context2 parent
private Context2 child
Constructor Detail |
Context2(Context2 parent)
Method Detail |
Context2 getChild()
Context2 getParent()
void setParent(Context2 parent)
void declarePrefix(String prefix, String uri)
prefix
- The prefix to declare.uri
- The associated Namespace URI.org.xml.sax.helpers.NamespaceSupport2#declarePrefix
String[] processName(String qName, boolean isAttribute)
qName
- The raw XML 1.0 name.isAttribute
- true if this is an attribute name.
org.xml.sax.helpers.NamespaceSupport2#processName
String getURI(String prefix)
prefix
- The prefix to look up.
org.xml.sax.helpers.NamespaceSupport2#getURI
String getPrefix(String uri)
Since many prefixes may be mapped to the same URI, the return value may be unreliable.
uri
- The URI to look up.
org.xml.sax.helpers.NamespaceSupport2#getPrefix
Enumeration getDeclaredPrefixes()
org.xml.sax.helpers.NamespaceSupport2#getDeclaredPrefixes
Enumeration getPrefixes()
The default prefix, if in force, is not returned, and will have to be checked for separately.
org.xml.sax.helpers.NamespaceSupport2#getPrefixes
private void copyTables()
This class is optimized for the normal case where most elements do not contain Namespace declarations. In that case, the Context2 will share data structures with its parent. New tables are obtained only when new declarations are issued, so they can be popped off the stack.
JJK: **** Alternative: each Context2 might declare _only_ its local bindings, and delegate upward if not found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |