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.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionintNumber of attributes in tag.intgetAttributeIndex(String name, boolean caseSensitive) Determine which attribute has the specified name.getAttributeName(int index) Get name of attribute.getAttributeValue(int index) Get value of an attribute.getAttributeValue(String name, boolean caseSensitive) Get value of an attribute.Get the complete tag in its original form, preserving original formatting.getName()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.voidWrite out the complete tag in its original form, preserving original formatting.
-
Field Details
-
OPEN
static final int OPEN- See Also:
-
CLOSE
static final int CLOSE- See Also:
-
EMPTY
static final int EMPTY- See Also:
-
OPEN_MAGIC_COMMENT
static final int OPEN_MAGIC_COMMENT- See Also:
-
CLOSE_MAGIC_COMMENT
static final int CLOSE_MAGIC_COMMENT- See Also:
-
-
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. -
writeTo
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
Determine which attribute has the specified name. -
getAttributeName
Get name of attribute. -
getAttributeValue
Get value of an attribute. If this is an empty attribute (i.e. just a name, without a value), null is returned. -
getAttributeValue
Get value of an attribute. If this is an empty attribute (i.e. just a name, without a value), null is returned. -
hasAttribute
Determine if an attribute is present.
-