This interface represents a tag (<xxx yyy="zzz">) in the HTML document.
Adds capabilities to a Node that are specific to a tag.
breaksFlow
public boolean breaksFlow()
Determines if the given tag breaks the flow of text.
true
if following text would start on a new line,
false
otherwise.
getAttribute
public String getAttribute(String name)
Returns the value of an attribute.
name
- Name of attribute, case insensitive.
- The value associated with the attribute or null if it does
not exist, or is a stand-alone.
getAttributeEx
public Attribute getAttributeEx(String name)
Returns the attribute with the given name.
name
- Name of attribute, case insensitive.
- The attribute or null if it does
not exist.
getAttributesEx
public Vector getAttributesEx()
Gets the attributes in the tag.
getEndTag
public Tag getEndTag()
Get the end tag for this (composite) tag.
For a non-composite tag this always returns null
.
- The tag that terminates this composite tag, i.e. </HTML>.
getEndTagEnders
public String[] getEndTagEnders()
Return the set of end tag names that cause this tag to finish.
These are the end tags that if encountered while
scanning (a composite tag) will cause the generation of a virtual
tag.
Since this a a non-composite tag, it has no end tag enders.
- The names of following end tags that stop further scanning.
getEnders
public String[] getEnders()
Return the set of tag names that cause this tag to finish.
These are the normal (non end tags) that if encountered while
scanning (a composite tag) will cause the generation of a virtual
tag.
Since this a a non-composite tag, the default is no enders.
- The names of following tags that stop further scanning.
getEndingLineNumber
public int getEndingLineNumber()
Get the line number where this tag ends.
- The (zero based) line number in the page where this tag ends.
getIds
public String[] getIds()
Return the set of names handled by this tag.
Since this a a generic tag, it has no ids.
- The names to be matched that create tags of this type.
getRawTagName
public String getRawTagName()
Return the name of this tag.
- The tag name or null if this tag contains nothing or only
whitespace.
getStartingLineNumber
public int getStartingLineNumber()
Get the line number where this tag starts.
- The (zero based) line number in the page where this tag starts.
getTagName
public String getTagName()
Return the name of this tag.
Note: This value is converted to uppercase and does not
begin with "/" if it is an end tag. Nor does it end with
a slash in the case of an XML type tag.
The conversion to uppercase is performed with an ENGLISH locale.
getThisScanner
public Scanner getThisScanner()
Return the scanner associated with this tag.
- The scanner associated with this tag.
isEmptyXmlTag
public boolean isEmptyXmlTag()
Is this an empty xml tag of the form <tag/>.
- true if the last character of the last attribute is a '/'.
isEndTag
public boolean isEndTag()
Predicate to determine if this tag is an end tag (i.e. </HTML>).
true
if this tag is an end tag.
removeAttribute
public void removeAttribute(String key)
Remove the attribute with the given key, if it exists.
key
- The name of the attribute.
setAttribute
public void setAttribute(String key,
String value)
Set attribute with given key, value pair.
Figures out a quote character to use if necessary.
key
- The name of the attribute.value
- The value of the attribute.
setAttribute
public void setAttribute(String key,
String value,
char quote)
Set attribute with given key/value pair, the value is quoted by quote.
key
- The name of the attribute.value
- The value of the attribute.quote
- The quote character to be used around value.
If zero, it is an unquoted value.
setAttributeEx
public void setAttributeEx(Attribute attribute)
Set an attribute.
This replaces an attribute of the same name.
To set the zeroth attribute (the tag name), use setTagName().
attribute
- The attribute to set.
setAttributesEx
public void setAttributesEx(Vector attribs)
Sets the attributes.
NOTE: Values of the extended hashtable are two element arrays of String,
with the first element being the original name (not uppercased),
and the second element being the value.
attribs
- The attribute collection to set.
setEmptyXmlTag
public void setEmptyXmlTag(boolean emptyXmlTag)
Set this tag to be an empty xml node, or not.
Adds or removes an ending slash on the tag.
emptyXmlTag
- If true, ensures there is an ending slash in the node,
i.e. <tag/>, otherwise removes it.
setEndTag
public void setEndTag(Tag tag)
Set the end tag for this (composite) tag.
For a non-composite tag this is a no-op.
tag
- The tag that closes this composite tag, i.e. </HTML>.
setTagName
public void setTagName(String name)
Set the name of this tag.
This creates or replaces the first attribute of the tag (the
zeroth element of the attribute vector).
setThisScanner
public void setThisScanner(Scanner scanner)
Set the scanner associated with this tag.
scanner
- The scanner for this tag.