Interface Attributes
-
public interface AttributesThis interface represents a list of XML attributes.
It is a more generic version of
org.xml.sax.AttributeswithStringreturned values replaced by the more versatileCharSequence.Note: To parse primitive types attributes (e.g. int, long, double), the use of the
TypeFormatclass is recommended (faster and avoids memory allocation).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description intgetIndex(java.lang.String qName)Looks up the index of an attribute by XML 1.0 qualified name (convenience method).intgetIndex(java.lang.String uri, java.lang.String localName)Looks up the index of an attribute by namespace name (convenience method).intgetLength()Returns the number of attributes in this list of attributes.java.lang.CharSequencegetLocalName(int index)Looks up an attribute's local name by index.java.lang.CharSequencegetQName(int index)Looks up an attribute's XML 1.0 qualified name by index.java.lang.StringgetType(int index)Looks up an attribute's type by index.java.lang.StringgetType(java.lang.String qName)Looks up an attribute's type by XML 1.0 qualified name.java.lang.StringgetType(java.lang.String uri, java.lang.String localName)Looks up an attribute's type by Namespace name (convenience method).java.lang.CharSequencegetURI(int index)Looks up an attribute's Namespace URI by index.java.lang.CharSequencegetValue(int index)Looks up an attribute's value by index.java.lang.CharSequencegetValue(java.lang.String qName)Looks up an attribute's value by XML 1.0 qualified name (convenience method).java.lang.CharSequencegetValue(java.lang.String uri, java.lang.String localName)Looks up an attribute's value by Namespace name (convenience method).
-
-
-
Method Detail
-
getLength
int getLength()
Returns the number of attributes in this list of attributes.- Returns:
- the number of attributes.
-
getURI
java.lang.CharSequence getURI(int index)
Looks up an attribute's Namespace URI by index.- Parameters:
index- the attribute index (zero-based).- Returns:
- the Namespace URI, or an empty character sequence if none is
available, or
nullif the index is out of range. - See Also:
getLength()
-
getLocalName
java.lang.CharSequence getLocalName(int index)
Looks up an attribute's local name by index.- Parameters:
index- the attribute index (zero-based).- Returns:
- the local name, or an empty character sequence if Namespace
processing is not being performed, or
nullif the index is out of range. - See Also:
getLength()
-
getQName
java.lang.CharSequence getQName(int index)
Looks up an attribute's XML 1.0 qualified name by index.- Parameters:
index- the attribute index (zero-based).- Returns:
- the XML 1.0 qualified name, or an empty character sequence if
none is available, or
nullif the index is out of range. - See Also:
getLength()
-
getType
java.lang.String getType(int index)
Looks up an attribute's type by index.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-TextBuilder Normalization").
For an enumerated attribute that is not a notation, the parser will report the type as "NMTOKEN".
- Parameters:
index- the attribute index (zero-based).- Returns:
- the attribute's type as a string, or null if the index is out of range.
- See Also:
getLength()
-
getValue
java.lang.CharSequence getValue(int index)
Looks up an attribute's value by index.If the attribute value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens will be concatenated into a single string with each token separated by a single space.
- Parameters:
index- the attribute index (zero-based).- Returns:
- the attribute's value as a character sequence,
nullif the index is out of range. - See Also:
getLength()
-
getIndex
int getIndex(java.lang.String uri, java.lang.String localName)Looks up the index of an attribute by namespace name (convenience method). This method returns the index of the attribute whose uri/localName have the same character content as the specified uri/localName.- Parameters:
uri- the Namespace URI, or an empty character sequence if the name has no Namespace URI.localName- the attribute's local name.- Returns:
- the index of the attribute, or
-1if it does not appear in the list.
-
getIndex
int getIndex(java.lang.String qName)
Looks up the index of an attribute by XML 1.0 qualified name (convenience method). This method returns the index of the attribute whose name has the same character content as the specified qName.- Parameters:
qName- the qualified (prefixed) name.- Returns:
- the index of the attribute, or
-1if it does not appear in the list.
-
getType
java.lang.String getType(java.lang.String uri, java.lang.String localName)Looks up an attribute's type by Namespace name (convenience method). This method returns the type of the attribute whose uri/localName have the same character content as the specified uri/localName.- Parameters:
uri- the Namespace URI, or an empty string if the name has no Namespace URI.localName- the local name of the attribute.- Returns:
- the attribute type as a string, or null if the attribute is not in the list or if Namespace processing is not being performed.
-
getType
java.lang.String getType(java.lang.String qName)
Looks up an attribute's type by XML 1.0 qualified name. This method returns the type of the attribute whose qName has the same character content as the specified qName.- Parameters:
qName- The XML 1.0 qualified name.- Returns:
- the attribute type as a string, or null if the attribute is not in the list or if qualified names are not available.
-
getValue
java.lang.CharSequence getValue(java.lang.String uri, java.lang.String localName)Looks up an attribute's value by Namespace name (convenience method). This method returns the value of the attribute whose uri/localName have the same character content as the specified uri/localName.- Parameters:
uri- the Namespace URI, or the empty string if the name has no Namespace URI.localName- the local name of the attribute.- Returns:
- the attribute value as a character sequence, or
nullif the attribute is not in the list.
-
getValue
java.lang.CharSequence getValue(java.lang.String qName)
Looks up an attribute's value by XML 1.0 qualified name (convenience method). This method returns the value of the attribute whose qName has the same character content as the specified qName.- Parameters:
qName- The XML 1.0 qualified name.- Returns:
- the attribute value as a character sequence, or
nullif the attribute is not in the list or if qualified names are not available.
-
-
DMelt 3.0 © DataMelt by jWork.ORG