org.xml.sax.Attributes
public final class AttributeCollection
extends java.lang.Object
implements org.xml.sax.Attributes
Constructor | Description |
---|---|
AttributeCollection(NamePool pool) |
Create an empty attribute list.
|
AttributeCollection(NamePool pool,
int n) |
Create an empty attribute list with space for n attributes
|
AttributeCollection(NamePool pool,
org.xml.sax.Attributes atts) |
Create a new attribute collection as a clone
|
AttributeCollection(AttributeCollection atts) |
Create a new attribute collection as a clone
|
Modifier and Type | Method | Description |
---|---|---|
void |
addAttribute(int nameCode,
java.lang.String type,
java.lang.String value) |
Add an attribute to an attribute list.
|
void |
addAttribute(java.lang.String prefix,
java.lang.String uri,
java.lang.String localName,
java.lang.String type,
java.lang.String value) |
Add an attribute to an attribute list.
|
void |
clear() |
Clear the attribute list.
|
void |
compact() |
Compact the attribute list to avoid wasting memory
|
int |
getIndex(java.lang.String name) |
Get the index of an attribute (by name).
|
int |
getIndex(java.lang.String uri,
java.lang.String localname) |
Get the index of an attribute (by name).
|
int |
getIndexByFingerprint(int fingerprint) |
Get the index, given the fingerprint
|
int |
getLength() |
Return the number of attributes in the list.
|
java.lang.String |
getLocalName(int index) |
Get the local name of an attribute (by position).
|
int |
getNameCode(int index) |
Get the namecode of an attribute (by position).
|
java.lang.String |
getQName(int index) |
Get the display name of an attribute (by position).
|
java.lang.String |
getType(int index) |
Get the type of an attribute (by position).
|
java.lang.String |
getType(java.lang.String name) |
Get the type of an attribute (by name).
|
java.lang.String |
getType(java.lang.String uri,
java.lang.String localname) |
Get the type of an attribute (by name).
|
java.lang.String |
getURI(int index) |
Get the namespace URI of an attribute (by position).
|
java.lang.String |
getValue(int index) |
Get the value of an attribute (by position).
|
java.lang.String |
getValue(java.lang.String name) |
Get the value of an attribute (by name).
|
java.lang.String |
getValue(java.lang.String uri,
java.lang.String localname) |
Get the value of an attribute (by name).
|
java.lang.String |
getValueByFingerprint(int fingerprint) |
Get the attribute value using its fingerprint
|
void |
setAttribute(int nameCode,
java.lang.String type,
java.lang.String value) |
Set an attribute value
|
void |
setAttribute(java.lang.String prefix,
java.lang.String uri,
java.lang.String localName,
java.lang.String type,
java.lang.String value) |
Set an attribute value
|
public AttributeCollection(NamePool pool)
public AttributeCollection(NamePool pool, int n)
public AttributeCollection(AttributeCollection atts)
public AttributeCollection(NamePool pool, org.xml.sax.Attributes atts)
public void addAttribute(int nameCode, java.lang.String type, java.lang.String value)
name
- The attribute name.type
- The attribute type ("NMTOKEN" for an enumeration).value
- The attribute value (must not be null).DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)
public void addAttribute(java.lang.String prefix, java.lang.String uri, java.lang.String localName, java.lang.String type, java.lang.String value)
prefix
- The namespace prefix of the attribute name.uri
- The namespace uri of the attribute name.localname
- The local part of the attribute name.type
- The attribute type (e.g. "NMTOKEN").value
- The attribute value (must not be null).DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)
public void setAttribute(java.lang.String prefix, java.lang.String uri, java.lang.String localName, java.lang.String type, java.lang.String value)
name
- the name of the attributetype
- the type of the attribute (e.g. CDATA)value
- the value of the attributepublic void setAttribute(int nameCode, java.lang.String type, java.lang.String value)
name
- the name of the attributetype
- the type of the attribute (e.g. CDATA)value
- the value of the attributepublic void clear()
public void compact()
public int getLength()
getLength
in interface org.xml.sax.Attributes
public int getNameCode(int index)
i
- The position of the attribute in the list.public java.lang.String getQName(int index)
getQName
in interface org.xml.sax.Attributes
i
- The position of the attribute in the list.public java.lang.String getLocalName(int index)
getLocalName
in interface org.xml.sax.Attributes
i
- The position of the attribute in the list.public java.lang.String getURI(int index)
getURI
in interface org.xml.sax.Attributes
index
- The position of the attribute in the list.public java.lang.String getType(int index)
getType
in interface org.xml.sax.Attributes
index
- The position of the attribute in the list.public java.lang.String getType(java.lang.String uri, java.lang.String localname)
getType
in interface org.xml.sax.Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.public java.lang.String getValue(int index)
getValue
in interface org.xml.sax.Attributes
index
- The position of the attribute in the list.public java.lang.String getValue(java.lang.String uri, java.lang.String localname)
getValue
in interface org.xml.sax.Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.public java.lang.String getValueByFingerprint(int fingerprint)
public int getIndex(java.lang.String name)
getIndex
in interface org.xml.sax.Attributes
name
- The display name of the attribute.public int getIndex(java.lang.String uri, java.lang.String localname)
getIndex
in interface org.xml.sax.Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.public int getIndexByFingerprint(int fingerprint)
public java.lang.String getType(java.lang.String name)
getType
in interface org.xml.sax.Attributes
name
- The display name of the attribute.public java.lang.String getValue(java.lang.String name)
getValue
in interface org.xml.sax.Attributes
name
- The attribute name.