Interface Tag

All Known Implementing Classes:
CustomTag, Parser.ReusableToken

public interface Tag
Tag returned by HTMLTagTokenizer. Allows easy access to element name and attributes. This interface supports read-only operations on the tag. To change a tag, use CustomTag.
Author:
Joe Walnes
See Also:
  • Field Details

  • Method Details

    • getContents

      String getContents()
      Get the complete tag in its original form, preserving original formatting. This has a slight overhead in that it needs to construct a String. For improved performance, use writeTo() instead.
      Returns:
      the contents
    • writeTo

      void writeTo(SitemeshBufferFragment.Builder fragment, int position)
      Write out the complete tag in its original form, preserving original formatting.
      Parameters:
      fragment - the fragment
      position - the position
    • getName

      String getName()
      Name of tag (ie. element name).
      Returns:
      the name
    • getType

      int getType()
      Type of tag:
      <blah> - Tag.OPEN
      </blah> - Tag.CLOSE
      <blah/> - Tag.EMPTY
      Returns:
      the type
    • getAttributeCount

      int getAttributeCount()
      Number of attributes in tag.
      Returns:
      the attribute count
    • getAttributeIndex

      int getAttributeIndex(String name, boolean caseSensitive)
      Determine which attribute has the specified name.
      Parameters:
      name - the name
      caseSensitive - the case sensitive
      Returns:
      the attribute index
    • getAttributeName

      String getAttributeName(int index)
      Get name of attribute.
      Parameters:
      index - the index
      Returns:
      the attribute name
    • getAttributeValue

      String getAttributeValue(int index)
      Get value of an attribute. If this is an empty attribute (i.e. just a name, without a value), null is returned.
      Parameters:
      index - the index
      Returns:
      the attribute value
    • getAttributeValue

      String getAttributeValue(String name, boolean caseSensitive)
      Get value of an attribute. If this is an empty attribute (i.e. just a name, without a value), null is returned.
      Parameters:
      name - the name
      caseSensitive - the case sensitive
      Returns:
      the attribute value
    • hasAttribute

      boolean hasAttribute(String name, boolean caseSensitive)
      Determine if an attribute is present.
      Parameters:
      name - the name
      caseSensitive - the case sensitive
      Returns:
      true, if successful
    • getPosition

      int getPosition()
      The position of the tag.
      Returns:
      the position
    • getLength

      int getLength()
      The length of the tag.
      Returns:
      the length