public interface Tag extends Node
Modifier and Type | Method and Description |
---|---|
boolean |
breaksFlow()
Determines if the given tag breaks the flow of text.
|
java.lang.String |
getAttribute(java.lang.String name)
Returns the value of an attribute.
|
Attribute |
getAttributeEx(java.lang.String name)
Returns the attribute with the given name.
|
java.util.Hashtable |
getAttributes()
Deprecated.
Use getAttributesEx() instead.
|
java.util.Vector |
getAttributesEx()
Gets the attributes in the tag.
|
java.lang.String[] |
getEnders()
Return the set of tag names that cause this tag to finish.
|
int |
getEndingLineNumber()
Get the line number where this tag ends.
|
Tag |
getEndTag()
Get the end tag for this (composite) tag.
|
java.lang.String[] |
getEndTagEnders()
Return the set of end tag names that cause this tag to finish.
|
java.lang.String[] |
getIds()
Return the set of names handled by this tag.
|
java.lang.String |
getRawTagName()
Return the name of this tag.
|
int |
getStartingLineNumber()
Get the line number where this tag starts.
|
java.lang.String |
getTagName()
Return the name of this tag.
|
Scanner |
getThisScanner()
Return the scanner associated with this tag.
|
boolean |
isEmptyXmlTag()
Is this an empty xml tag of the form <tag/>.
|
boolean |
isEndTag()
Predicate to determine if this tag is an end tag (i.e.
|
void |
removeAttribute(java.lang.String key)
Remove the attribute with the given key, if it exists.
|
void |
setAttribute(java.lang.String key,
java.lang.String value)
Set attribute with given key, value pair.
|
void |
setAttribute(java.lang.String key,
java.lang.String value,
char quote)
Set attribute with given key/value pair, the value is quoted by quote.
|
void |
setAttributeEx(Attribute attribute)
Set an attribute.
|
void |
setAttributes(java.util.Hashtable attributes)
Deprecated.
Use setAttributesEx() instead.
|
void |
setAttributesEx(java.util.Vector attribs)
Sets the attributes.
|
void |
setEmptyXmlTag(boolean emptyXmlTag)
Set this tag to be an empty xml node, or not.
|
void |
setEndTag(Tag tag)
Set the end tag for this (composite) tag.
|
void |
setTagName(java.lang.String name)
Set the name of this tag.
|
void |
setThisScanner(Scanner scanner)
Set the scanner associated with this tag.
|
accept, clone, collectInto, doSemanticAction, getChildren, getEndPosition, getPage, getParent, getStartPosition, getText, setChildren, setEndPosition, setPage, setParent, setStartPosition, setText, toHtml, toPlainTextString, toString
java.lang.String getAttribute(java.lang.String name)
name
- Name of attribute, case insensitive.void setAttribute(java.lang.String key, java.lang.String value)
key
- The name of the attribute.value
- The value of the attribute.void setAttribute(java.lang.String key, java.lang.String value, char 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.void removeAttribute(java.lang.String key)
key
- The name of the attribute.Attribute getAttributeEx(java.lang.String name)
name
- Name of attribute, case insensitive.void setAttributeEx(Attribute attribute)
attribute
- The attribute to set.java.util.Vector getAttributesEx()
Attributes
in the tag.void setAttributesEx(java.util.Vector attribs)
attribs
- The attribute collection to set.java.util.Hashtable getAttributes()
getAttributesEx
which returns a list of Attribute
objects, which offer more information than the simple
String
objects available from this Hashtable
.null
if there was no value
for an attribute (either no equals sign or nothing to the right of the
equals sign). A special entry with a key of
SpecialHashtable.TAGNAME ("$void setAttributes(java.util.Hashtable attributes)
attributes
- The attribute collection to set.java.lang.String getTagName()
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.
void setTagName(java.lang.String name)
name
- The tag name.java.lang.String getRawTagName()
boolean breaksFlow()
true
if following text would start on a new line,
false
otherwise.boolean isEndTag()
true
if this tag is an end tag.boolean isEmptyXmlTag()
void setEmptyXmlTag(boolean emptyXmlTag)
emptyXmlTag
- If true, ensures there is an ending slash in the node,
i.e. <tag/>, otherwise removes it.java.lang.String[] getIds()
java.lang.String[] getEnders()
java.lang.String[] getEndTagEnders()
Tag getEndTag()
null
.void setEndTag(Tag tag)
tag
- The tag that closes this composite tag, i.e. </HTML>.Scanner getThisScanner()
void setThisScanner(Scanner scanner)
scanner
- The scanner for this tag.int getStartingLineNumber()
int getEndingLineNumber()
HTML Parser is an open source library released under LGPL.