public interface Tag extends Node
限定符和类型 | 方法和说明 |
---|---|
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.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 |
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, getFirstChild, getLastChild, getNextSibling, getPage, getParent, getPreviousSibling, getStartPosition, getText, setChildren, setEndPosition, setPage, setParent, setStartPosition, setText, toHtml, toHtml, toPlainTextString, toString
java.lang.String getAttribute(java.lang.String name)
name
- Name of attribute, case insensitive.setAttribute(java.lang.String, java.lang.String)
void setAttribute(java.lang.String key, java.lang.String value)
key
- The name of the attribute.value
- The value of the attribute.getAttribute(java.lang.String)
,
setAttribute(String,String,char)
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.getAttribute(java.lang.String)
void removeAttribute(java.lang.String key)
key
- The name of the attribute.Attribute getAttributeEx(java.lang.String name)
name
- Name of attribute, case insensitive.setAttributeEx(org.htmlparser.Attribute)
void setAttributeEx(Attribute attribute)
attribute
- The attribute to set.getAttributeEx(java.lang.String)
java.util.Vector getAttributesEx()
Attributes
in the tag.setAttributesEx(java.util.Vector)
void setAttributesEx(java.util.Vector attribs)
attribs
- The attribute collection to set.getAttributesEx()
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.
setTagName(java.lang.String)
void setTagName(java.lang.String name)
name
- The tag name.getTagName()
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
.setEndTag(org.htmlparser.Tag)
void setEndTag(Tag tag)
tag
- The tag that closes this composite tag, i.e. </HTML>.getEndTag()
Scanner getThisScanner()
setThisScanner(org.htmlparser.scanners.Scanner)
void setThisScanner(Scanner scanner)
scanner
- The scanner for this tag.getThisScanner()
int getStartingLineNumber()
int getEndingLineNumber()