totalcross.xml
Class AttributeList

totalcross.lang.Object
  extended by totalcross.util.Hashtable
      extended by totalcross.xml.AttributeList

public class AttributeList
extends Hashtable

This class describes the attributes attached to a start-tag. Tags are case-insensitive.

The AttributeListIterator() class provides an iterator over the components of each attribute in this AttributeList instance:


Nested Class Summary
static interface AttributeList.Filter
          interface to filter each attribute before to enter it in this AttributeList
 class AttributeList.Iterator
          class to iterate over each attribute if an AttributeList
 
Nested classes/interfaces inherited from class totalcross.util.Hashtable
Hashtable.Entry
 
Field Summary
 boolean caseInsensitive
          Set to true if you want the get/set methods to be case insensitive.
 
Fields inherited from class totalcross.util.Hashtable
collisions, table
 
Constructor Summary
AttributeList()
           
AttributeList(AttributeList source)
          Clone
 
Method Summary
 void addAttribute(String attrName, String attrValue, byte dlm)
          Add a new attribute to this AttributeList
 String getAttributeValue(String name)
          Get the attribute value for a given name
 int getAttributeValueAsInt(String name, int defaultValue)
          Get the attribute value for a given name as an integer
 
Methods inherited from class totalcross.util.Hashtable
clear, copyInto, exists, get, get, get, get, getKeys, getKeyValuePairs, getValues, put, put, rehash, remove, remove, size
 
Methods inherited from class totalcross.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

caseInsensitive

public boolean caseInsensitive
Set to true if you want the get/set methods to be case insensitive.

Constructor Detail

AttributeList

public AttributeList()

AttributeList

public AttributeList(AttributeList source)
Clone

Method Detail

addAttribute

public final void addAttribute(String attrName,
                               String attrValue,
                               byte dlm)
Add a new attribute to this AttributeList

Parameters:
attrName - name of the attribute
attrValue - unquoted value of the attribute
dlm - delimiter that started the attribute value (' or "). '\0' if none

getAttributeValue

public final String getAttributeValue(String name)
Get the attribute value for a given name

Parameters:
name - attribute name
Returns:
the value, or null if it wasn't specified

getAttributeValueAsInt

public final int getAttributeValueAsInt(String name,
                                        int defaultValue)
Get the attribute value for a given name as an integer

Parameters:
name - attribute name
Returns:
the value, or the default value if it wasn't specified or there's a problem in the number convertion