public final class Attributes extends java.lang.Object implements AttributeList
Constructor and Description |
---|
Attributes(DOM document,
int element) |
Modifier and Type | Method and Description |
---|---|
int |
getLength()
Return the number of attributes in this list.
|
java.lang.String |
getName(int i)
Return the name of an attribute in this list (by position).
|
java.lang.String |
getType(int i)
Return the type of an attribute in the list (by position).
|
java.lang.String |
getType(java.lang.String name)
Return the type of an attribute in the list (by name).
|
java.lang.String |
getValue(int i)
Return the value of an attribute in the list (by position).
|
java.lang.String |
getValue(java.lang.String name)
Return the value of an attribute in the list (by name).
|
public Attributes(DOM document, int element)
public int getLength()
AttributeList
The SAX parser may provide attributes in any arbitrary order, regardless of the order in which they were declared or specified. The number of attributes may be zero.
getLength
in interface AttributeList
public java.lang.String getName(int i)
AttributeList
The names must be unique: the SAX parser shall not include the same attribute twice. Attributes without values (those declared #IMPLIED without a value specified in the start tag) will be omitted from the list.
If the attribute name has a namespace prefix, the prefix will still be attached.
getName
in interface AttributeList
i
- The index of the attribute in the list (starting at 0).AttributeList.getLength()
public java.lang.String getType(int i)
AttributeList
The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper case).
If the parser has not read a declaration for the attribute, or if the parser does not report attribute types, then it must return the value "CDATA" as stated in the XML 1.0 Recommentation (clause 3.3.3, "Attribute-Value Normalization").
For an enumerated attribute that is not a notation, the parser will report the type as "NMTOKEN".
getType
in interface AttributeList
i
- The index of the attribute in the list (starting at 0).AttributeList.getLength()
,
AttributeList.getType(java.lang.String)
public java.lang.String getType(java.lang.String name)
AttributeList
The return value is the same as the return value for getType(int).
If the attribute name has a namespace prefix in the document, the application must include the prefix here.
getType
in interface AttributeList
name
- The name of the attribute.AttributeList.getType(int)
public java.lang.String getValue(int i)
AttributeList
If the attribute value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens will be concatenated into a single string separated by whitespace.
getValue
in interface AttributeList
i
- The index of the attribute in the list (starting at 0).AttributeList.getLength()
,
AttributeList.getValue(java.lang.String)
public java.lang.String getValue(java.lang.String name)
AttributeList
The return value is the same as the return value for getValue(int).
If the attribute name has a namespace prefix in the document, the application must include the prefix here.
getValue
in interface AttributeList
name
- the name of the attribute to returnAttributeList.getValue(int)
Copyright � 2014 Apache XML Project. All Rights Reserved.