This class provides a default implementation of the SAX2
Attributes
interface, with the
addition of manipulators so that the list can be modified or
reused.
There are two typical uses of this class:
startElement
event; orThis class replaces the now-deprecated SAX1 AttributeListImpl
class; in addition to supporting the updated Attributes
interface rather than the deprecated AttributeList
interface, it also includes a much more efficient
implementation using a single array rather than a set of Vectors.
Access | Constructor and Description |
---|---|
public | |
public |
Modifier and Type | Method and Description |
---|---|
public void | addAttribute(String
The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed. uri, String The local name, or the empty string if
Namespace processing is not being performed. localName, String The qualified (prefixed) name, or the empty string
if qualified names are not available. qName, String The attribute type as a string. type, String The attribute value. value)Add an attribute to the end of the list. |
private void | |
public void | |
private void | ensureCapacity(int
The minimum number of attributes that the array must
be able to hold. n)Ensure the internal array's capacity. |
public int | Returns: The attribute's index, or -1 if none matches.The attribute's Namespace URI, or the empty
string if none is available. uri, String The attribute's local name. localName)Implements org. |
public int | Returns: The attribute's index, or -1 if none matches.The qualified name. qName)Implements org. |
public int | Returns: The number of attributes in the list.Implements org. |
public String | Returns: The attribute's local name, the empty string if none is available, or null if the index if out of range.The attribute's index (zero-based). index)Implements org. |
public String | Returns: The attribute's qualified name, the empty string if none is available, or null if the index is out of bounds.The attribute's index (zero-based). index)Implements org. |
public String | Returns: The attribute's type, "CDATA" if the type is unknown, or null if the index is out of bounds.The attribute's index (zero-based). index)Implements org. |
public String | Returns: The attribute's type, or null if there is no matching attribute.The Namespace URI, or the empty string for a name
with no explicit Namespace URI. uri, String The local name. localName)Implements org. |
public String | Returns: The attribute's type, or null if there is no matching attribute.The qualified name. qName)Implements org. |
public String | Returns: The Namespace URI, the empty string if none is available, or null if the index is out of range.The attribute's index (zero-based). index)Implements org. |
public String | Returns: The attribute's value or null if the index is out of bounds.The attribute's index (zero-based). index)Implements org. |
public String | Returns: The attribute's value, or null if there is no matching attribute.The Namespace URI, or the empty string for a name
with no explicit Namespace URI. uri, String The local name. localName)Implements org. |
public String | Returns: The attribute's value, or null if there is no matching attribute.The qualified name. qName)Implements org. |
public void | removeAttribute(int
The index of the attribute (zero-based). index)Remove an attribute from the list. |
public void | setAttribute(int
The index of the attribute (zero-based). index, String The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed. uri, String The local name, or the empty string if
Namespace processing is not being performed. localName, String The qualified name, or the empty string
if qualified names are not available. qName, String The attribute type as a string. type, String The attribute value. value)Set an attribute in the list. |
public void | |
public void | setLocalName(int
The index of the attribute (zero-based). index, String The attribute's local name, or the empty
string for none. localName)Set the local name of a specific attribute. |
public void | |
public void | |
public void | |
public void |
AttributesImpl | back to summary |
---|---|
public AttributesImpl() Construct a new, empty AttributesImpl object. |
AttributesImpl | back to summary |
---|---|
public AttributesImpl(Attributes atts) Copy an existing Attributes object. This constructor is especially useful inside a
|
addAttribute | back to summary |
---|---|
public void addAttribute(String uri, String localName, String qName, String type, String value) Add an attribute to the end of the list. For the sake of speed, this method does no checking to see if the attribute is already in the list: that is the responsibility of the application.
|
badIndex | back to summary |
---|---|
private void badIndex(int index) throws ArrayIndexOutOfBoundsException Report a bad array index in a manipulator.
|
clear | back to summary |
---|---|
public void clear() Clear the attribute list for reuse. Note that little memory is freed by this call: the current array is kept so it can be reused. |
ensureCapacity | back to summary |
---|---|
private void ensureCapacity(int n) Ensure the internal array's capacity.
|
getIndex | back to summary |
---|---|
public int getIndex(String uri, String localName) Implements org. Look up an attribute's index by Namespace name. In many cases, it will be more efficient to look up the name once and use the index query methods rather than using the name query methods repeatedly.
|
getIndex | back to summary |
---|---|
public int getIndex(String qName) Implements org. Look up an attribute's index by qualified (prefixed) name.
|
getLength | back to summary |
---|---|
public int getLength() Implements org. Return the number of attributes in the list.
|
getLocalName | back to summary |
---|---|
public String getLocalName(int index) Implements org. Return an attribute's local name.
|
getQName | back to summary |
---|---|
public String getQName(int index) Implements org. Return an attribute's qualified (prefixed) name.
|
getType | back to summary |
---|---|
public String getType(int index) Implements org. Return an attribute's type by index.
|
getType | back to summary |
---|---|
public String getType(String uri, String localName) Implements org. Look up an attribute's type by Namespace-qualified name.
|
getType | back to summary |
---|---|
public String getType(String qName) Implements org. Look up an attribute's type by qualified (prefixed) name.
|
getURI | back to summary |
---|---|
public String getURI(int index) Implements org. Return an attribute's Namespace URI.
|
getValue | back to summary |
---|---|
public String getValue(int index) Implements org. Return an attribute's value by index.
|
getValue | back to summary |
---|---|
public String getValue(String uri, String localName) Implements org. Look up an attribute's value by Namespace-qualified name.
|
getValue | back to summary |
---|---|
public String getValue(String qName) Implements org. Look up an attribute's value by qualified (prefixed) name.
|
removeAttribute | back to summary |
---|---|
public void removeAttribute(int index) Remove an attribute from the list.
|
setAttribute | back to summary |
---|---|
public void setAttribute(int index, String uri, String localName, String qName, String type, String value) Set an attribute in the list. For the sake of speed, this method does no checking for name conflicts or well-formedness: such checks are the responsibility of the application.
|
setAttributes | back to summary |
---|---|
public void setAttributes(Attributes atts) Copy an entire Attributes object. It may be more efficient to reuse an existing object rather than constantly allocating new ones.
|
setLocalName | back to summary |
---|---|
public void setLocalName(int index, String localName) Set the local name of a specific attribute.
|
setQName | back to summary |
---|---|
public void setQName(int index, String qName) Set the qualified name of a specific attribute.
|
setType | back to summary |
---|---|
public void setType(int index, String type) Set the type of a specific attribute.
|
setURI | back to summary |
---|---|
public void setURI(int index, String uri) Set the Namespace URI of a specific attribute.
|
setValue | back to summary |
---|---|
public void setValue(int index, String value) Set the value of a specific attribute.
|