1 19 20 33 34 package org.htmlparser; 35 36 import org.htmlparser.util.NodeList; 37 import org.htmlparser.visitors.NodeVisitor; 38 39 42 public class RemarkNode extends Node 43 { 44 public final static String REMARK_NODE_FILTER = "-r"; 45 46 49 String tagContents; 50 58 public RemarkNode(int tagBegin, int tagEnd, String tagContents) 59 { 60 super(tagBegin, tagEnd); 61 this.tagContents = tagContents; 62 } 63 64 67 public String getText() 68 { 69 return tagContents; 70 } 71 public String toPlainTextString() 72 { 73 return tagContents; 74 } 75 public String toHtml() 76 { 77 return "<!--" + tagContents + "-->"; 78 } 79 82 public String toString() 83 { 84 return "Comment Tag : " 85 + tagContents 86 + "; begins at : " 87 + elementBegin() 88 + "; ends at : " 89 + elementEnd() 90 + "\n"; 91 } 92 93 public void collectInto(NodeList collectionList, String filter) 94 { 95 if (filter.equals(REMARK_NODE_FILTER)) 96 collectionList.add(this); 97 } 98 99 public void accept(NodeVisitor visitor) 100 { 101 visitor.visitRemarkNode(this); 102 } 103 104 } 105 | Popular Tags |