Package org.apache.xml.serializer
Class AttributesImplSerializer
java.lang.Object
org.xml.sax.helpers.AttributesImpl
org.apache.xml.serializer.AttributesImplSerializer
- All Implemented Interfaces:
Attributes
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.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidThis method adds the attribute, but also records its qName/index pair in the hashtable for fast lookup by getIndex(qName).final voidclear()This method clears the accumulated attributes.final intThis method gets the index of an attribute given its qName.final intThis method gets the index of an attribute given its uri and locanName.final voidsetAttributes(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).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
-
Constructor Details
-
AttributesImplSerializer
public AttributesImplSerializer()
-
-
Method Details
-
getIndex
This method gets the index of an attribute given its qName.- Specified by:
getIndexin interfaceAttributes- Overrides:
getIndexin classAttributesImpl- Parameters:
qname- the qualified name of the attribute, e.g. "prefix1:locName1"- Returns:
- the integer index of the attribute.
- See Also:
-
addAttribute
This method adds the attribute, but also records its qName/index pair in the hashtable for fast lookup by getIndex(qName).- Overrides:
addAttributein classAttributesImpl- Parameters:
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- See Also:
-
clear
public final void clear()This method clears the accumulated attributes.- Overrides:
clearin classAttributesImpl- See Also:
-
setAttributes
This method sets the attributes, previous attributes are cleared, it also keeps the hashtable up to date for quick lookup via getIndex(qName).- Overrides:
setAttributesin classAttributesImpl- Parameters:
atts- the attributes to copy into these attributes.- See Also:
-
getIndex
This method gets the index of an attribute given its uri and locanName.- Specified by:
getIndexin interfaceAttributes- Overrides:
getIndexin classAttributesImpl- Parameters:
uri- the URI of the attribute name.localName- the local namer (after the ':' ) of the attribute name.- Returns:
- the integer index of the attribute.
- See Also:
-