# AttributeListImpl

public class **AttributeListImpl** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [AttributeList](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html)


**This class is deprecated.**   
This class implements a deprecated interface,
`https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html`;
that interface has been replaced by
`https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/Attributes.html`,
which is implemented in the
`https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributesImpl.html` helper class.

Default implementation for AttributeList.

> *This module, both source code and documentation, is in the
> Public Domain, and comes with **NO WARRANTY**.* See <http://www.saxproject.org> for further information.

AttributeList implements the deprecated SAX1 `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html` interface, and has been
replaced by the new SAX2 `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributesImpl.html` interface.

This class provides a convenience implementation of the SAX
`https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html` interface. This
implementation is useful both for SAX parser writers, who can use
it to provide attributes to the application, and for SAX application
writers, who can use it to create a persistent copy of an element's
attribute specifications:

```
 private AttributeList myatts;

 public void startElement (String name, AttributeList atts)
 {
              // create a persistent copy of the attribute list
              // for use outside this method
   myatts = new AttributeListImpl(atts);
   [...]
 }
 
```

Please note that SAX parsers are not required to use this
class to provide an implementation of AttributeList; it is
supplied only as an optional convenience. In particular,
parser writers are encouraged to invent more efficient
implementations.

<br />

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/DocumentHandler.html#startElement(java.lang.String,%20org.xml.sax.AttributeList)`

### Public Constructor Summary

|---|---|
|   | [AttributeListImpl](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#AttributeListImpl())() Create an empty attribute list. |
|   | [AttributeListImpl](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#AttributeListImpl(org.xml.sax.AttributeList))([AttributeList](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html) atts) Construct a persistent copy of an existing attribute list. |

### Public Method Summary

|---|---|
| void | [addAttribute](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#addAttribute(java.lang.String,%20java.lang.String,%20java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) type, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) value) Add an attribute to an attribute list. |
| void | [clear](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#clear())() Clear the attribute list. |
| int | [getLength](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#getLength())() Return the number of attributes in the list. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getName](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#getName(int))(int i) Get the name of an attribute (by position). |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getType](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#getType(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Get the type of an attribute (by name). |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getType](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#getType(int))(int i) Get the type of an attribute (by position). |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getValue](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#getValue(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Get the value of an attribute (by name). |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getValue](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#getValue(int))(int i) Get the value of an attribute (by position). |
| void | [removeAttribute](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#removeAttribute(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Remove an attribute from the list. |
| void | [setAttributeList](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#setAttributeList(org.xml.sax.AttributeList))([AttributeList](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html) atts) Set the attribute list, discarding previous contents. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [org.xml.sax.AttributeList](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html)

|---|---|
| abstract int | [getLength](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getLength())() Return the number of attributes in this list. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getName](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getName(int))(int i) Return the name of an attribute in this list (by position). |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getType](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getType(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Return the type of an attribute in the list (by name). |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getType](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getType(int))(int i) Return the type of an attribute in the list (by position). |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getValue](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getValue(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Return the value of an attribute in the list (by name). |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getValue](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getValue(int))(int i) Return the value of an attribute in the list (by position). |

## Public Constructors

#### public
**AttributeListImpl**
()

Create an empty attribute list.

This constructor is most useful for parser writers, who
will use it to create a single, reusable attribute list that
can be reset with the clear method between elements.

<br />

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#addAttribute(java.lang.String,%20java.lang.String,%20java.lang.String)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#clear()`

#### public
**AttributeListImpl**
([AttributeList](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html) atts)

Construct a persistent copy of an existing attribute list.

This constructor is most useful for application writers,
who will use it to create a persistent copy of an existing
attribute list.

<br />

##### Parameters

| atts | The attribute list to copy |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/DocumentHandler.html#startElement(java.lang.String,%20org.xml.sax.AttributeList)`

## Public Methods

#### public void
**addAttribute**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) type, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) value)

Add an attribute to an attribute list.

This method is provided for SAX parser writers, to allow them
to build up an attribute list incrementally before delivering
it to the application.

<br />

##### Parameters

| name | The attribute name. |
| type | The attribute type ("NMTOKEN" for an enumeration). |
| value | The attribute value (must not be null). |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#removeAttribute(java.lang.String)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/DocumentHandler.html#startElement(java.lang.String,%20org.xml.sax.AttributeList)`

#### public void
**clear**
()

Clear the attribute list.

SAX parser writers can use this method to reset the attribute
list between DocumentHandler.startElement events. Normally,
it will make sense to reuse the same AttributeListImpl object
rather than allocating a new one each time.

<br />

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/DocumentHandler.html#startElement(java.lang.String,%20org.xml.sax.AttributeList)`

#### public int
**getLength**
()

Return the number of attributes in the list.

##### Returns

- The number of attributes in the list.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getLength()`

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getName**
(int i)

Get the name of an attribute (by position).

##### Parameters

| i | The position of the attribute in the list. |
|---|---|

##### Returns

- The attribute name as a string, or null if there is no attribute at that position.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getName(int)`

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getType**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Get the type of an attribute (by name).

##### Parameters

| name | The attribute name. |
|---|---|

##### Returns

- The attribute type as a string ("NMTOKEN" for an enumeration, and "CDATA" if no declaration was read).

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getType(java.lang.String)`

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getType**
(int i)

Get the type of an attribute (by position).

##### Parameters

| i | The position of the attribute in the list. |
|---|---|

##### Returns

- The attribute type as a string ("NMTOKEN" for an enumeration, and "CDATA" if no declaration was read), or null if there is no attribute at that position.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getType(int)`

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getValue**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Get the value of an attribute (by name).

##### Parameters

| name | The attribute name. |
|---|---|

##### Returns

- the named attribute's value or null, if the attribute does not exist.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getValue(java.lang.String)`

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getValue**
(int i)

Get the value of an attribute (by position).

##### Parameters

| i | The position of the attribute in the list. |
|---|---|

##### Returns

- The attribute value as a string, or null if there is no attribute at that position.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html#getValue(int)`

#### public void
**removeAttribute**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Remove an attribute from the list.

SAX application writers can use this method to filter an
attribute out of an AttributeList. Note that invoking this
method will change the length of the attribute list and
some of the attribute's indices.

If the requested attribute is not in the list, this is
a no-op.

<br />

##### Parameters

| name | The attribute name. |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/helpers/AttributeListImpl.html#addAttribute(java.lang.String,%20java.lang.String,%20java.lang.String)`

#### public void
**setAttributeList**
([AttributeList](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/AttributeList.html) atts)

Set the attribute list, discarding previous contents.

This method allows an application writer to reuse an
attribute list easily.

<br />

##### Parameters

| atts | The attribute list to copy. |
|---|---|