| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xml.sax.helpers.AttributesImpl
org.apache.xml.serializer.AttributesImplSerializer
public final class AttributesImplSerializer
This class extends org.xml.sax.helpers.AttributesImpl which implements org. xml.sax.Attributes. But for optimization this class adds a Hashtable for faster lookup of an index by qName, which is commonly done in the stream serializer.
Attributes| Field Summary | |
|---|---|
| private  java.lang.StringBuffer | m_buff | 
| private  java.util.Hashtable | m_indexFromQNameHash table of qName/index values to quickly lookup the index of an attributes qName. | 
| private static int | MAXThis is the number of attributes before switching to the hash table, and can be tuned, but 12 seems good for now - Brian M. | 
| private static int | MAXMinus1One less than the number of attributes before switching to the Hashtable. | 
| Constructor Summary | |
|---|---|
| AttributesImplSerializer() | |
| Method Summary | |
|---|---|
|  void | addAttribute(java.lang.String uri,
                         java.lang.String local,
                         java.lang.String qname,
                         java.lang.String type,
                         java.lang.String val)This method adds the attribute, but also records its qName/index pair in the hashtable for fast lookup by getIndex(qName). | 
|  void | clear()This method clears the accumulated attributes. | 
|  int | getIndex(java.lang.String qname)This method gets the index of an attribute given its qName. | 
|  int | getIndex(java.lang.String uri,
                 java.lang.String localName)This method gets the index of an attribute given its uri and locanName. | 
|  void | setAttributes(org.xml.sax.Attributes atts)This method sets the attributes, previous attributes are cleared, it also keeps the hashtable up to date for quick lookup via getIndex(qName). | 
| private  void | switchOverToHash(int numAtts)We are switching over to having a hash table for quick look up of attributes, but up until now we haven't kept any information in the Hashtable, so we now update the Hashtable. | 
| Methods inherited from class org.xml.sax.helpers.AttributesImpl | 
|---|
| getLength, getLocalName, getQName, getType, getType, getType, getURI, getValue, getValue, getValue, removeAttribute, setAttribute, setLocalName, setQName, setType, setURI, setValue | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
private final java.util.Hashtable m_indexFromQName
private final java.lang.StringBuffer m_buff
private static final int MAX
private static final int MAXMinus1
| Constructor Detail | 
|---|
public AttributesImplSerializer()
| Method Detail | 
|---|
public final int getIndex(java.lang.String qname)
getIndex in interface org.xml.sax.AttributesgetIndex in class org.xml.sax.helpers.AttributesImplqname - the qualified name of the attribute, e.g. "prefix1:locName1"
Attributes.getIndex(String)
public final void addAttribute(java.lang.String uri,
                               java.lang.String local,
                               java.lang.String qname,
                               java.lang.String type,
                               java.lang.String val)
addAttribute in class org.xml.sax.helpers.AttributesImpluri - the URI of the attributelocal - the local name of the attributeqname - the qualified name of the attributetype - the type of the attributeval - the value of the attributeAttributesImpl.addAttribute(String, String, String, String, String), 
getIndex(String)private void switchOverToHash(int numAtts)
numAtts - public final void clear()
clear in class org.xml.sax.helpers.AttributesImplAttributesImpl.clear()public final void setAttributes(org.xml.sax.Attributes atts)
setAttributes in class org.xml.sax.helpers.AttributesImplatts - the attributes to copy into these attributes.AttributesImpl.setAttributes(Attributes), 
getIndex(String)
public final int getIndex(java.lang.String uri,
                          java.lang.String localName)
getIndex in interface org.xml.sax.AttributesgetIndex in class org.xml.sax.helpers.AttributesImpluri - the URI of the attribute name.localName - the local namer (after the ':' ) of the attribute name.
Attributes.getIndex(String)| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||