|
HTML Parser Home Page | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.htmlparser.AbstractNode
org.htmlparser.lexer.nodes.TagNode
TagNode represents a generic tag.
| Field Summary | |
protected static Hashtable |
breakTags
Set of tags that breaks the flow. |
protected Vector |
mAttributes
The tag attributes. |
| Fields inherited from class org.htmlparser.AbstractNode |
children, mPage, nodeBegin, nodeEnd, parent |
| Constructor Summary | |
TagNode()
Create an empty tag. |
|
TagNode(Page page,
int start,
int end,
Vector attributes)
Create a tag with the location and attributes provided |
|
| Method Summary | |
void |
accept(Object visitor)
Apply the visitor object (of type NodeVisitor) to this node. |
boolean |
breaksFlow()
Determines if the given tag breaks the flow of text. |
String |
getAttribute(String name)
Returns the value of an attribute. |
Attribute |
getAttributeEx(String name)
Returns the attribute with the given name. |
Hashtable |
getAttributes()
Gets the attributes in the tag. |
Vector |
getAttributesEx()
Gets the attributes in the tag. |
int |
getEndingLineNumber()
Get the line number where this tag ends. |
String |
getParameter(String name)
Deprecated. use getAttribute instead |
Hashtable |
getParsed()
Deprecated. This method is deprecated. Use getAttributes() instead. |
String |
getRawTagName()
Return the name of this tag. |
int |
getStartingLineNumber()
Get the line number where this tag starts. |
int |
getTagBegin()
Gets the nodeBegin. |
int |
getTagEnd()
Gets the nodeEnd. |
String |
getTagName()
Return the name of this tag. |
String |
getText()
Return the text contained in 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(String key)
Remove the attribute with the given key, if it exists. |
void |
setAttribute(Attribute attribute)
Set an attribute. |
void |
setAttribute(String key,
String value)
Set attribute with given key, value pair. |
void |
setAttribute(String key,
String value,
char quote)
Set attribute with given key, value pair where the value is quoted by quote. |
void |
setAttributes(Hashtable attributes)
Sets the attributes. |
void |
setAttributesEx(Vector attribs)
Sets the attributes. |
void |
setEmptyXmlTag(boolean emptyXmlTag)
Set this tag to be an empty xml node, or not. |
void |
setTagBegin(int tagBegin)
Sets the nodeBegin. |
void |
setTagEnd(int tagEnd)
Sets the nodeEnd. |
void |
setTagName(String name)
Set the name of this tag. |
void |
setText(String text)
Sets the string contents of the node. |
String |
toHtml()
Render the tag as HTML. |
String |
toPlainTextString()
Get the plain text from this node. |
String |
toString()
Print the contents of the tag |
| Methods inherited from class org.htmlparser.AbstractNode |
collectInto, doSemanticAction, elementBegin, elementEnd, getChildren, getEndPosition, getPage, getParent, getStartPosition, setChildren, setEndPosition, setPage, setParent, setStartPosition, toHTML |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected Vector mAttributes
Attribute.
protected static Hashtable breakTags
| Constructor Detail |
public TagNode()
public TagNode(Page page,
int start,
int end,
Vector attributes)
page - The page this tag was read from.start - The starting offset of this node within the page.end - The ending offset of this node within the page.attributes - The list of attributes that were parsed in this tag.Attribute| Method Detail |
public String getAttribute(String name)
name - Name of attribute, case insensitive.
public void setAttribute(String key,
String value)
key - The name of the attribute.value - The value of the attribute.public void removeAttribute(String key)
key - The name of the attribute.
public void setAttribute(String key,
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.public Attribute getAttributeEx(String name)
name - Name of attribute, case insensitive.
public void setAttribute(Attribute attribute)
attribute - The attribute to set.public String getParameter(String name)
getAttribute (name).
name - Name of attribute.public Vector getAttributesEx()
Attributes in the tag.public 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 (no equals
sign or nothing to the right of the equals sign). A special entry with
a key of SpecialHashtable.TAGNAME ("$public 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.
To get at the original text of the tag name use
getRawTagName().
The conversion to uppercase is performed with an ENGLISH locale.
public String getRawTagName()
public void setTagName(String name)
name - The tag name.public String getText()
getText in interface NodegetText in class AbstractNodepublic void setAttributes(Hashtable attributes)
attributes - The attribute collection to set.public void setAttributesEx(Vector attribs)
attribs - The attribute collection to set.public void setTagBegin(int tagBegin)
tagBegin - The nodeBegin to setpublic int getTagBegin()
public void setTagEnd(int tagEnd)
tagEnd - The nodeEnd to setpublic int getTagEnd()
public void setText(String text)
AbstractNode
setText in interface NodesetText in class AbstractNodetext - The new text for the node.public String toPlainTextString()
toPlainTextString in interface NodetoPlainTextString in class AbstractNodetoHtml().public String toHtml()
toHtml() method will render it in HTML.
toHtml in interface NodetoHtml in class AbstractNodeNode.toHtml()public String toString()
toString in interface NodetoString in class AbstractNodepublic boolean breaksFlow()
true if following text would start on a new line,
false otherwise.public Hashtable getParsed()
public void accept(Object visitor)
Node
accept in interface Nodeaccept in class AbstractNodepublic boolean isEmptyXmlTag()
public void setEmptyXmlTag(boolean emptyXmlTag)
emptyXmlTag - If true, ensures there is an ending slash in the node,
i.e. <tag/>, otherwise removes it.public boolean isEndTag()
true if this tag is an end tag.public int getStartingLineNumber()
public int getEndingLineNumber()
|
© 2004 Somik Raha Mar 14, 2004
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||