Class 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:

    • the attribute name
    • the unquoted value
    • the quote, if one exists
    • 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()
        Constructs an empty attributeList with 5 free positions.
      • AttributeList

        public AttributeList​(AttributeList source)
        Clones the given attributeList.
        Parameters:
        source - The attributeList to be cloned.
    • Method Detail

      • addAttribute

        public final void addAttribute​(java.lang.String attrName,
                                       java.lang.String attrValue,
                                       byte 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 null if 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.