org.apache.xml.serializer
Class AttributesImplSerializer
- Attributes
public 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
static int | MAX - This is the number of attributes before switching to the hash table,
and can be tuned, but 12 seems good for now - bjm
|
void | addAttribute(String uri, String local, String qname, String type, 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(String qname) - This method gets the index of an attribute given its qName.
|
void | setAttributes(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).
|
addAttribute , clear , getIndex , getIndex , getLength , getLocalName , getQName , getType , getType , getType , getURI , getValue , getValue , getValue , removeAttribute , setAttribute , setAttributes , setLocalName , setQName , setType , setURI , setValue |
MAX
public static final int MAX
This is the number of attributes before switching to the hash table,
and can be tuned, but 12 seems good for now - bjm
- 12
addAttribute
public void addAttribute(String uri,
String local,
String qname,
String type,
String val)
This method adds the attribute, but also records its qName/index pair in
the hashtable for fast lookup by getIndex(qName).
- addAttribute in interface AttributesImpl
uri
- 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 attribute
AttributesImpl.addAttribute(String,String,String,String,String)
, getIndex(String)
getIndex
public int getIndex(String qname)
This method gets the index of an attribute given its qName.
- getIndex in interface Attributes
- getIndex in interface AttributesImpl
qname
- the qualified name of the attribute, e.g. "prefix1:locName1"
- the integer index of the attribute.
Attributes.getIndex(String)
Copyright B) 2004 Apache XML Project. All Rights Reserved.