org.apache.xml.serializer

Class AttributesImplSerializer

public final class AttributesImplSerializer extends AttributesImpl

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: org.xml.sax.Attributes

UNKNOWN: internal

Method Summary
voidaddAttribute(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).
voidclear()
This method clears the accumulated attributes.
intgetIndex(String qname)
This method gets the index of an attribute given its qName.
intgetIndex(String uri, String localName)
This method gets the index of an attribute given its uri and locanName.
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).

Method Detail

addAttribute

public final 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).

Parameters: uri the URI of the attribute local the local name of the attribute qname the qualified name of the attribute type the type of the attribute val the value of the attribute

See Also: org.xml.sax.helpers.AttributesImpl#addAttribute(String, String, String, String, String) getIndex

clear

public final void clear()
This method clears the accumulated attributes.

See Also: org.xml.sax.helpers.AttributesImpl#clear()

getIndex

public final int getIndex(String qname)
This method gets the index of an attribute given its qName.

Parameters: qname the qualified name of the attribute, e.g. "prefix1:locName1"

Returns: the integer index of the attribute.

See Also: org.xml.sax.Attributes#getIndex(String)

getIndex

public final int getIndex(String uri, String localName)
This method gets the index of an attribute given its uri and locanName.

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: org.xml.sax.Attributes#getIndex(String)

setAttributes

public final 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).

Parameters: atts the attributes to copy into these attributes.

See Also: org.xml.sax.helpers.AttributesImpl#setAttributes(Attributes) getIndex

Copyright B) 2005 Apache XML Project. All Rights Reserved.