org.htmlparser.nodes

Class RemarkNode

Implemented Interfaces:
Cloneable, Node, Remark, Serializable

public class RemarkNode
extends AbstractNode
implements Remark

The remark tag is identified and represented by this class.

Field Summary

protected String
mText
The contents of the remark node, or override text.

Fields inherited from class org.htmlparser.nodes.AbstractNode

children, mPage, nodeBegin, nodeEnd, parent

Constructor Summary

RemarkNode(String text)
Constructor takes in the text string.
RemarkNode(Page page, int start, int end)
Constructor takes in the page and beginning and ending posns.

Method Summary

void
accept(NodeVisitor visitor)
Remark visiting code.
String
getText()
Returns the text contents of the comment tag.
void
setText(String text)
Sets the string contents of the node.
String
toHtml(boolean verbatim)
Return The full HTML remark.
String
toPlainTextString()
Return the remark text.
String
toString()
Print the contents of the remark tag.

Methods inherited from class org.htmlparser.nodes.AbstractNode

accept, clone, collectInto, doSemanticAction, getChildren, getEndPosition, getFirstChild, getLastChild, getNextSibling, getPage, getParent, getPreviousSibling, getStartPosition, getText, setChildren, setEndPosition, setPage, setParent, setStartPosition, setText, toHtml, toHtml, toPlainTextString, toString

Field Details

mText

protected String mText
The contents of the remark node, or override text.

Constructor Details

RemarkNode

public RemarkNode(String text)
Constructor takes in the text string.
Parameters:
text - The string node text. For correct generation of HTML, this should not contain representations of tags (unless they are balanced).

RemarkNode

public RemarkNode(Page page,
                  int start,
                  int end)
Constructor takes in the page and beginning and ending posns.
Parameters:
page - The page this remark is on.
start - The beginning position of the remark.
end - The ending positiong of the remark.

Method Details

accept

public void accept(NodeVisitor visitor)
Remark visiting code.
Specified by:
accept in interface Node
Overrides:
accept in interface AbstractNode
Parameters:
visitor - The NodeVisitor object to invoke visitRemarkNode() on.

getText

public String getText()
Returns the text contents of the comment tag.
Specified by:
getText in interface Remark
getText in interface Node
Overrides:
getText in interface AbstractNode
Returns:
The contents of the text inside the comment delimiters.

setText

public void setText(String text)
Sets the string contents of the node. If the text has the remark delimiters (<!-- -->), these are stripped off.
Specified by:
setText in interface Remark
setText in interface Node
Overrides:
setText in interface AbstractNode
Parameters:
text - The new text for the node.

toHtml

public String toHtml(boolean verbatim)
Return The full HTML remark.
Specified by:
toHtml in interface Node
Overrides:
toHtml in interface AbstractNode
Parameters:
verbatim - If true return as close to the original page text as possible.
Returns:
The comment, i.e. .

toPlainTextString

public String toPlainTextString()
Return the remark text.
Specified by:
toPlainTextString in interface Node
Overrides:
toPlainTextString in interface AbstractNode
Returns:
The HTML comment.

toString

public String toString()
Print the contents of the remark tag. This is suitable for display in a debugger or output to a printout. Control characters are replaced by their equivalent escape sequence and contents is truncated to 80 characters.
Specified by:
toString in interface Node
Overrides:
toString in interface AbstractNode
Returns:
A string representation of the remark node.

HTML Parser is an open source library released under LGPL. SourceForge.net