Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| HTML Parser Home Page
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.htmlparser.lexer.nodes
Class RemarkNode

    java.lang.Object
      org.htmlparser.AbstractNode
          org.htmlparser.lexer.nodes.RemarkNode

All Implemented Interfaces:
  Node, Serializable

Direct Known Subclasses:
  RemarkNode

public class RemarkNode
extends AbstractNode

The remark tag is identified and represented by this class.

See Also:
  Serialized Form

Field Summary
`protected String` | `mText` The contents of the remark node, or override text.

Fields inherited from class org.htmlparser.AbstractNode
`children, mPage, nodeBegin, nodeEnd, parent`

Constructor Summary
`RemarkNode(Page page, int start, int end)` Constructor takes in the page and beginning and ending posns.
`RemarkNode(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 contents of the comment tag.
`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()` Print the contents of the remark 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

### mText

    protected String mText

  The contents of the remark node, or override text.

Constructor Detail

### 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 Detail

### getText

    public String getText()

  Returns the text contents of the comment tag.

  Specified by:
    `getText` in interface `Node`
  Overrides:
    `getText` in class `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 `Node`
  Overrides:
    `setText` in class `AbstractNode`
  Parameters:
    `text` - The new text for the node.

### toPlainTextString

    public String toPlainTextString()

  Description copied from class: `AbstractNode`
  Returns a string representation of the node. This is an important method, it allows a simple string transformation of a web page, regardless of a node.
  Typical application code (for extracting only the text from a web page) would then be simplified to :

       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
       }

  Specified by:
    `toPlainTextString` in interface `Node`
  Specified by:
    `toPlainTextString` in class `AbstractNode`

### toHtml

    public String toHtml()

  Description copied from class: `AbstractNode`
  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

  Specified by:
    `toHtml` in interface `Node`
  Specified by:
    `toHtml` in class `AbstractNode`

### 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`
  Specified by:
    `toString` in class `AbstractNode`
  Returns:
    A string representation of the remark node.

### accept

    public void accept(Object visitor)

  Description copied from interface: `Node`
  Apply the visitor object (of type NodeVisitor) to this node.

  Specified by:
    `accept` in interface `Node`
  Specified by:
    `accept` in class `AbstractNode`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| © 2004 Somik Raha Mar 14, 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

HTML Parser is an open source library released under LGPL.