|
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.StringNode
Normal text in the HTML document is represented by this class.
| Field Summary | |
protected String |
mText
The contents of the string node, or override text. |
| Fields inherited from class org.htmlparser.AbstractNode |
children, mPage, nodeBegin, nodeEnd, parent |
| Constructor Summary | |
StringNode(Page page,
int start,
int end)
Constructor takes in the page and beginning and ending posns. |
|
StringNode(String text)
Constructor takes in the text string. |
|
| Method Summary | |
void |
accept(Object visitor)
Apply the visitor object (of type NodeVisitor) to this node. |
String |
getText()
Returns the text of the string line. |
void |
setText(String text)
Sets the string contents of the node. |
String |
toHtml()
This method will make it easier when using html parser to reproduce html pages (with or without modifications) Applications reproducing html can use this method on nodes which are to be used or transferred as they were recieved, with the original html |
String |
toPlainTextString()
Returns a string representation of the node. |
String |
toString()
Express this string node as a printable string This is suitable for display in a debugger or output to a printout. |
| 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 String mText
| Constructor Detail |
public StringNode(String text)
text - The string node text. For correct generation of HTML, this
should not contain representations of tags (unless they are balanced).
public StringNode(Page page,
int start,
int end)
page - The page this string is on.start - The beginning position of the string.end - The ending positiong of the string.| Method Detail |
public String getText()
getText in interface NodegetText in class AbstractNodepublic void setText(String text)
setText in interface NodesetText in class AbstractNodetext - The new text for the node.public String toPlainTextString()
AbstractNode
Node node;
for (Enumeration e = parser.elements();e.hasMoreElements();) {
node = (Node)e.nextElement();
System.out.println(node.toPlainTextString()); // Or do whatever processing you wish with the plain text string
}
toPlainTextString in interface NodetoPlainTextString in class AbstractNodepublic String toHtml()
AbstractNode
toHtml in interface NodetoHtml in class AbstractNodepublic String toString()
toString in interface NodetoString in class AbstractNodepublic void accept(Object visitor)
Node
accept in interface Nodeaccept in class AbstractNode
|
© 2004 Somik Raha Mar 14, 2004
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||