Package totalcross.xml
Class AttributeList
- java.lang.Object
-
- totalcross.util.Hashtable
-
- totalcross.xml.AttributeList
-
public class AttributeList extends Hashtable
This class describes the attributes attached to a start-tag. Tags are case-insensitive.The
AttributeListIteratorclass provides an iterator over the components of each attribute in this AttributeList instance:- the attribute name
- the unquoted value
- the quote, if one exists
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAttributeList.FilterInterface to filter each attribute before entering it in theAttributeList.classAttributeList.IteratorClass to iterate over each attribute of anAttributeList-
Nested classes/interfaces inherited from class totalcross.util.Hashtable
Hashtable.Entry
-
-
Field Summary
Fields Modifier and Type Field Description booleancaseInsensitiveSet to true if you want the get/set methods to be case insensitive.-
Fields inherited from class totalcross.util.Hashtable
allowDuplicateKeys, collisions, table
-
-
Constructor Summary
Constructors Constructor Description AttributeList()Constructs an emptyattributeListwith 5 free positions.AttributeList(AttributeList source)Clones the givenattributeList.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(java.lang.String attrName, java.lang.String attrValue, char dlm)Adds a new attribute to this AttributeListjava.lang.StringgetAttributeValue(java.lang.String name)Gets the attribute value for a given name.intgetAttributeValueAsInt(java.lang.String name, int defaultValue)Gets the attribute value for a given name as an integer.
-
-
-
Constructor Detail
-
AttributeList
public AttributeList()
Constructs an emptyattributeListwith 5 free positions.
-
AttributeList
public AttributeList(AttributeList source)
Clones the givenattributeList.- Parameters:
source- TheattributeListto be cloned.
-
-
Method Detail
-
addAttribute
public final void addAttribute(java.lang.String attrName, java.lang.String attrValue, char dlm)Adds a new attribute to this AttributeList- Parameters:
attrName- The name of the attribute.attrValue- The unquoted value of the attribute.dlm- Delimiter that started the attribute value ('or"), or'\0'if none.
-
getAttributeValue
public final java.lang.String getAttributeValue(java.lang.String name)
Gets the attribute value for a given name.- Parameters:
name- The attribute name.- Returns:
- The value, or
nullif it wasn't specified.
-
getAttributeValueAsInt
public final int getAttributeValueAsInt(java.lang.String name, int defaultValue)Gets the attribute value for a given name as an integer.- Parameters:
name- The attribute name.defaultValue- The default value if there is no value for the attribute name.- Returns:
- The value, or the default value if it wasn't specified or there's a problem in the number conversion.
-
-