Interface Tag

All Known Implementing Classes:
ParsedTag

public interface Tag
Tag definition.
  • Method Details

    • isCaseSensitive

      boolean isCaseSensitive()
      Returns case-sensitive flag for various name matching.
    • isRawTag

      boolean isRawTag()
      Returns true if tag should parse inner text content as RAWTEXT.
    • getName

      CharSequence getName()
      Returns tags name.
    • getType

      TagType getType()
      Returns type of tag (e.g. open, close, etc).
    • getId

      CharSequence getId()
      Returns id attribute value of a tag. Implementations may simply call getAttributeValue(java.lang.CharSequence) or to cache this value for better performances.
    • getDeepLevel

      int getDeepLevel()
      Returns 1-based deep level of a tag from the root.
    • getAttributeCount

      int getAttributeCount()
      Returns number of tag attributes.
    • getAttributeName

      CharSequence getAttributeName(int index)
      Returns attribute name.
    • getAttributeValue

      CharSequence getAttributeValue(int index)
      Returns attribute value or null for an empty attribute,
    • getAttributeValue

      CharSequence getAttributeValue(CharSequence name)
      Returns attribute value or null for an empty attribute, Returns null also if attribute name does not exist.
    • getAttributeIndex

      int getAttributeIndex(CharSequence name)
      Returns attribute index or -1 if not found.
    • hasAttribute

      boolean hasAttribute(CharSequence name)
      Detects if an attribute is present.
    • getTagPosition

      int getTagPosition()
      Returns tag position in the input source.
    • getTagLength

      int getTagLength()
      Returns tag length in the input source.
    • getPosition

      String getPosition()
      Returns tag position string or null if position is not calculated.
    • setName

      void setName(CharSequence tagName)
      Sets tag name.
    • setType

      void setType(TagType type)
      Sets tag type.
    • addAttribute

      void addAttribute(CharSequence name, CharSequence value)
      Adds new attribute without checking if it already exist thus allowing duplicate attributes.
    • setAttribute

      void setAttribute(CharSequence name, CharSequence value)
      Sets new attribute value. If attribute already exist, it's value is changed. If attribute does not exist, it will be added to the tag.
    • setAttributeValue

      void setAttributeValue(int index, CharSequence value)
      Sets value for attribute at specific index. Throws exception if index is invalid.
    • setAttributeValue

      void setAttributeValue(CharSequence name, CharSequence value)
      Sets value for attribute with given name. If attribute with given name doesn't exist, nothing changes.
    • setAttributeName

      void setAttributeName(int index, CharSequence name)
      Changes attribute name on specific index. Throws exception if index is invalid.
    • removeAttribute

      void removeAttribute(int index)
      Removes attribute at given index. Throws exception if index is invalid.
    • removeAttribute

      void removeAttribute(CharSequence name)
      Removes attribute by given name.
    • removeAttributes

      void removeAttributes()
      Removes all attributes.
    • isModified

      boolean isModified()
      Returns true if tag is modified.
    • nameEquals

      boolean nameEquals(CharSequence charSequence)
      Returns true if name equals to given char sequence.
    • writeTo

      void writeTo(Appendable out)
      Writes the tag to the output.
    • toString

      String toString()
      Get the complete tag as a string.
      Overrides:
      toString in class Object