Interface Tag
-
- All Known Implementing Classes:
CustomTag,Parser.ReusableToken
public interface TagTag returned by HTMLTagTokenizer. Allows easy access to element name and attributes. This interface supports read-only operations on the tag. To change a tag, useCustomTag.- Author:
- Joe Walnes
- See Also:
TokenHandler,TagTokenizer,CustomTag
-
-
Field Summary
Fields Modifier and Type Field Description static intCLOSEstatic intCLOSE_MAGIC_COMMENTstatic intEMPTYstatic intOPENstatic intOPEN_MAGIC_COMMENT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetAttributeCount()Number of attributes in tag.intgetAttributeIndex(String name, boolean caseSensitive)Determine which attribute has the specified name.StringgetAttributeName(int index)Get name of attribute.StringgetAttributeValue(int index)Get value of an attribute.StringgetAttributeValue(String name, boolean caseSensitive)Get value of an attribute.StringgetContents()Get the complete tag in its original form, preserving original formatting.StringgetName()Name of tag (ie.intgetType()Type of tag:
<blah> - Tag.OPEN
</blah> - Tag.CLOSE
<blah/> - Tag.EMPTYbooleanhasAttribute(String name, boolean caseSensitive)Determine if an attribute is present.voidwriteTo(CharArray out)Write out the complete tag in its original form, preserving original formatting.
-
-
-
Field Detail
-
OPEN
static final int OPEN
- See Also:
- Constant Field Values
-
CLOSE
static final int CLOSE
- See Also:
- Constant Field Values
-
EMPTY
static final int EMPTY
- See Also:
- Constant Field Values
-
OPEN_MAGIC_COMMENT
static final int OPEN_MAGIC_COMMENT
- See Also:
- Constant Field Values
-
CLOSE_MAGIC_COMMENT
static final int CLOSE_MAGIC_COMMENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
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.
-
writeTo
void writeTo(CharArray out)
Write out the complete tag in its original form, preserving original formatting.
-
getName
String getName()
Name of tag (ie. element name).
-
getType
int getType()
Type of tag:
<blah> - Tag.OPEN
</blah> - Tag.CLOSE
<blah/> - Tag.EMPTY
-
getAttributeCount
int getAttributeCount()
Number of attributes in tag.
-
getAttributeIndex
int getAttributeIndex(String name, boolean caseSensitive)
Determine which attribute has the specified name.
-
getAttributeName
String getAttributeName(int index)
Get name of attribute.
-
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.
-
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.
-
hasAttribute
boolean hasAttribute(String name, boolean caseSensitive)
Determine if an attribute is present.
-
-