com.icl.saxon.tree
public final class AttributeCollection extends Object implements Attributes
Constructor and Description |
---|
AttributeCollection(AttributeCollection atts)
Create a new attribute collection as a clone
|
AttributeCollection(NamePool pool)
Create an empty attribute list.
|
AttributeCollection(NamePool pool,
Attributes atts)
Create a new attribute collection as a clone
|
AttributeCollection(NamePool pool,
int n)
Create an empty attribute list with space for n attributes
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(int nameCode,
String type,
String value)
Add an attribute to an attribute list.
|
void |
addAttribute(String prefix,
String uri,
String localName,
String type,
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(String name)
Get the index of an attribute (by name).
|
int |
getIndex(String uri,
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.
|
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).
|
String |
getQName(int index)
Get the display name of an attribute (by position).
|
String |
getType(int index)
Get the type of an attribute (by position).
|
String |
getType(String name)
Get the type of an attribute (by name).
|
String |
getType(String uri,
String localname)
Get the type of an attribute (by name).
|
String |
getURI(int index)
Get the namespace URI of an attribute (by position).
|
String |
getValue(int index)
Get the value of an attribute (by position).
|
String |
getValue(String name)
Get the value of an attribute (by name).
|
String |
getValue(String uri,
String localname)
Get the value of an attribute (by name).
|
String |
getValueByFingerprint(int fingerprint)
Get the attribute value using its fingerprint
|
void |
setAttribute(int nameCode,
String type,
String value)
Set an attribute value
|
void |
setAttribute(String prefix,
String uri,
String localName,
String type,
String value)
Set an attribute value
|
public AttributeCollection(NamePool pool)
public AttributeCollection(NamePool pool, int n)
public AttributeCollection(AttributeCollection atts)
public AttributeCollection(NamePool pool, Attributes atts)
public void addAttribute(int nameCode, String type, 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(String prefix, String uri, String localName, String type, 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(String prefix, String uri, String localName, String type, 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, String type, 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 Attributes
public int getNameCode(int index)
i
- The position of the attribute in the list.public String getQName(int index)
getQName
in interface Attributes
i
- The position of the attribute in the list.public String getLocalName(int index)
getLocalName
in interface Attributes
i
- The position of the attribute in the list.public String getURI(int index)
getURI
in interface Attributes
index
- The position of the attribute in the list.public String getType(int index)
getType
in interface Attributes
index
- The position of the attribute in the list.public String getType(String uri, String localname)
getType
in interface Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.public String getValue(int index)
getValue
in interface Attributes
index
- The position of the attribute in the list.public String getValue(String uri, String localname)
getValue
in interface Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.public String getValueByFingerprint(int fingerprint)
public int getIndex(String name)
getIndex
in interface Attributes
name
- The display name of the attribute.public int getIndex(String uri, String localname)
getIndex
in interface Attributes
uri
- The namespace uri of the attribute.localname
- The local name of the attribute.public int getIndexByFingerprint(int fingerprint)
public String getType(String name)
getType
in interface Attributes
name
- The display name of the attribute.public String getValue(String name)
getValue
in interface Attributes
name
- The attribute name.