Interface Tag
- All Known Implementing Classes:
ParsedTag
public interface Tag
Tag definition.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(CharSequence name, CharSequence value) Adds new attribute without checking if it already exist thus allowing duplicate attributes.intReturns number of tag attributes.intReturns attribute index or-1if not found.getAttributeName(int index) Returns attribute name.getAttributeValue(int index) Returns attribute value ornullfor an empty attribute,Returns attribute value ornullfor an empty attribute, Returnsnullalso if attribute name does not exist.intReturns 1-based deep level of a tag from the root.getId()Returns id attribute value of a tag.getName()Returns tags name.Returns tag position string ornullif position is not calculated.intReturns tag length in the input source.intReturns tag position in the input source.getType()Returnstype of tag(e.g.booleanhasAttribute(CharSequence name) Detects if an attribute is present.booleanReturns case-sensitive flag for various name matching.booleanReturnstrueif tag is modified.booleanisRawTag()Returnstrueif tag should parse inner text content as RAWTEXT.booleannameEquals(CharSequence charSequence) Returnstrueif name equals to given char sequence.voidremoveAttribute(int index) Removes attribute at given index.voidremoveAttribute(CharSequence name) Removes attribute by given name.voidRemoves all attributes.voidsetAttribute(CharSequence name, CharSequence value) Sets new attribute value.voidsetAttributeName(int index, CharSequence name) Changes attribute name on specific index.voidsetAttributeValue(int index, CharSequence value) Sets value for attribute at specific index.voidsetAttributeValue(CharSequence name, CharSequence value) Sets value for attribute with given name.voidsetName(CharSequence tagName) Sets tag name.voidSetstag type.toString()Get the complete tag as a string.voidwriteTo(Appendable out) Writes the tag to the output.
-
Method Details
-
isCaseSensitive
boolean isCaseSensitive()Returns case-sensitive flag for various name matching. -
isRawTag
boolean isRawTag()Returnstrueif tag should parse inner text content as RAWTEXT. -
getName
CharSequence getName()Returns tags name. -
getType
TagType getType()Returnstype of tag(e.g. open, close, etc). -
getId
CharSequence getId()Returns id attribute value of a tag. Implementations may simply callgetAttributeValue(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
Returns attribute name. -
getAttributeValue
Returns attribute value ornullfor an empty attribute, -
getAttributeValue
Returns attribute value ornullfor an empty attribute, Returnsnullalso if attribute name does not exist. -
getAttributeIndex
Returns attribute index or-1if not found. -
hasAttribute
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 ornullif position is not calculated. -
setName
Sets tag name. -
setType
-
addAttribute
Adds new attribute without checking if it already exist thus allowing duplicate attributes. -
setAttribute
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
Sets value for attribute at specific index. Throws exception if index is invalid. -
setAttributeValue
Sets value for attribute with given name. If attribute with given name doesn't exist, nothing changes. -
setAttributeName
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
Removes attribute by given name. -
removeAttributes
void removeAttributes()Removes all attributes. -
isModified
boolean isModified()Returnstrueif tag is modified. -
nameEquals
Returnstrueif name equals to given char sequence. -
writeTo
Writes the tag to the output. -
toString
-