[Htmlparser-cvs] htmlparser/src/org/htmlparser/lexer/nodes AbstractNode.java,1.2,1.3 RemarkNode.java
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-09-03 23:36:52
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/nodes In directory sc8-pr-cvs1:/tmp/cvs-serv31228/lexer/nodes Modified Files: AbstractNode.java RemarkNode.java StringNode.java TagNode.java Log Message: Change tabs to spaces in all source files. Index: AbstractNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/nodes/AbstractNode.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractNode.java 24 Aug 2003 21:59:41 -0000 1.2 --- AbstractNode.java 3 Sep 2003 23:36:18 -0000 1.3 *************** *** 49,53 **** * Create a lexeme. * Remember the page and start & end cursor positions. ! * @param page The page this tag was read from. * @param start The starting offset of this node within the page. * @param end The ending offset of this node within the page. --- 49,53 ---- * Create a lexeme. * Remember the page and start & end cursor positions. ! * @param page The page this tag was read from. * @param start The starting offset of this node within the page. * @param end The ending offset of this node within the page. Index: RemarkNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/nodes/RemarkNode.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RemarkNode.java 24 Aug 2003 21:59:41 -0000 1.3 --- RemarkNode.java 3 Sep 2003 23:36:18 -0000 1.4 *************** *** 39,76 **** public class RemarkNode extends AbstractNode { ! public final static String REMARK_NODE_FILTER="-r"; ! ! /** ! * Constructor takes in the text string, beginning and ending posns. ! * @param page The page this string is on. ! * @param start The beginning position of the string. ! * @param end The ending positiong of the string. ! */ ! public RemarkNode (Page page, int start, int end) ! { ! super (page, start, end); ! } /** ! * Returns the text contents of the comment tag. * todo: this only works for the usual case. ! */ ! public String getText() ! { ! return (mPage.getText (elementBegin () + 4, elementEnd () - 3)); ! } public String toPlainTextString() { ! return (getText()); ! } ! public String toHtml() { ! return (mPage.getText (elementBegin (), elementEnd ())); ! } ! /** ! * Print the contents of the remark tag. ! */ ! public String toString() ! { Cursor start; Cursor end; --- 39,76 ---- public class RemarkNode extends AbstractNode { ! public final static String REMARK_NODE_FILTER="-r"; ! ! /** ! * Constructor takes in the text string, beginning and ending posns. ! * @param page The page this string is on. ! * @param start The beginning position of the string. ! * @param end The ending positiong of the string. ! */ ! public RemarkNode (Page page, int start, int end) ! { ! super (page, start, end); ! } /** ! * Returns the text contents of the comment tag. * todo: this only works for the usual case. ! */ ! public String getText() ! { ! return (mPage.getText (elementBegin () + 4, elementEnd () - 3)); ! } public String toPlainTextString() { ! return (getText()); ! } ! public String toHtml() { ! return (mPage.getText (elementBegin (), elementEnd ())); ! } ! /** ! * Print the contents of the remark tag. ! */ ! public String toString() ! { Cursor start; Cursor end; *************** *** 78,89 **** start = new Cursor (getPage (), elementBegin ()); end = new Cursor (getPage (), elementEnd ()); ! return ("Rem (" + start.toString () + "," + end.toString () + "): " + getText ()); ! } ! public void collectInto(NodeList collectionList, String filter) { ! if (filter==REMARK_NODE_FILTER) collectionList.add(this); ! } ! public void accept(Object visitor) { ! } } --- 78,89 ---- start = new Cursor (getPage (), elementBegin ()); end = new Cursor (getPage (), elementEnd ()); ! return ("Rem (" + start.toString () + "," + end.toString () + "): " + getText ()); ! } ! public void collectInto(NodeList collectionList, String filter) { ! if (filter==REMARK_NODE_FILTER) collectionList.add(this); ! } ! public void accept(Object visitor) { ! } } Index: StringNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/nodes/StringNode.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StringNode.java 24 Aug 2003 21:59:41 -0000 1.3 --- StringNode.java 3 Sep 2003 23:36:19 -0000 1.4 *************** *** 40,55 **** public class StringNode extends AbstractNode { ! public static final String STRING_FILTER = "-string"; ! ! /** ! * Constructor takes in the text string, beginning and ending posns. ! * @param page The page this string is on. ! * @param start The beginning position of the string. ! * @param end The ending positiong of the string. ! */ ! public StringNode (Page page, int start, int end) ! { ! super (page, start, end); ! } /** --- 40,55 ---- public class StringNode extends AbstractNode { ! public static final String STRING_FILTER = "-string"; ! ! /** ! * Constructor takes in the text string, beginning and ending posns. ! * @param page The page this string is on. ! * @param start The beginning position of the string. ! * @param end The ending positiong of the string. ! */ ! public StringNode (Page page, int start, int end) ! { ! super (page, start, end); ! } /** *************** *** 89,93 **** public String toString () ! { Cursor start; Cursor end; --- 89,93 ---- public String toString () ! { Cursor start; Cursor end; *************** *** 95,100 **** start = new Cursor (getPage (), elementBegin ()); end = new Cursor (getPage (), elementEnd ()); ! return ("Txt (" + start.toString () + "," + end.toString () + "): " + getText ()); ! } --- 95,100 ---- start = new Cursor (getPage (), elementBegin ()); end = new Cursor (getPage (), elementEnd ()); ! return ("Txt (" + start.toString () + "," + end.toString () + "): " + getText ()); ! } Index: TagNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/nodes/TagNode.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TagNode.java 24 Aug 2003 21:59:41 -0000 1.5 --- TagNode.java 3 Sep 2003 23:36:19 -0000 1.6 *************** *** 48,69 **** public class TagNode extends AbstractNode { ! public static final String TYPE = "TAG"; ! /** ! * Constant used as value for the value of the tag name ! * in parseParameters (Kaarle Kaila 3.8.2001) ! */ ! public final static String TAGNAME = "$<TAGNAME>$"; ! public final static String EMPTYTAG = "$<EMPTYTAG>$"; public final static String NULLVALUE = "$<NULL>$"; public final static String NOTHING = "$<NOTHING>$"; ! private final static String EMPTY_STRING=""; ! ! private boolean emptyXmlTag = false; /** ! * The tag attributes. * Objects of type Attribute. ! */ ! protected Vector mAttributes; /** --- 48,69 ---- public class TagNode extends AbstractNode { ! public static final String TYPE = "TAG"; ! /** ! * Constant used as value for the value of the tag name ! * in parseParameters (Kaarle Kaila 3.8.2001) ! */ ! public final static String TAGNAME = "$<TAGNAME>$"; ! public final static String EMPTYTAG = "$<EMPTYTAG>$"; public final static String NULLVALUE = "$<NULL>$"; public final static String NOTHING = "$<NOTHING>$"; ! private final static String EMPTY_STRING=""; ! ! private boolean emptyXmlTag = false; /** ! * The tag attributes. * Objects of type Attribute. ! */ ! protected Vector mAttributes; /** *************** *** 106,171 **** } ! /** ! * Create a tag with the location and attributes provided ! * @param page The page this tag was read from. * @param start The starting offset of this node within the page. * @param end The ending offset of this node within the page. * @param attributes The list of attributes that were parsed in this tag. * @see Attribute ! */ ! public TagNode (Page page, int start, int end, Vector attributes) ! { ! super (page, start, end); mAttributes = attributes; ! } ! /** ! * In case the tag is parsed at the scan method this will return value of a ! * parameter not implemented yet ! * @param name of parameter ! */ ! public String getAttribute (String name) { ! return ((String)getAttributes().get(name.toUpperCase())); ! } ! /** ! * Set attribute with given key, value pair. ! * @param key ! * @param value ! */ ! public void setAttribute(String key, String value) { ! getAttributes ().put(key,value); ! } ! /** ! * In case the tag is parsed at the scan method this will return value of a ! * parameter not implemented yet ! * @param name of parameter ! * @deprecated use getAttribute instead ! */ ! public String getParameter(String name) { ! return (String)getAttributes().get (name.toUpperCase()); ! } ! ! /** ! * Gets the attributes in the tag. * NOTE: Values of the extended hashtable are two element arrays of String, * with the first element being the original name (not uppercased), * and the second element being the value. ! * @return Returns a special hashtable of attributes in two element String arrays. ! */ ! public Vector getAttributesEx() { ! return mAttributes; ! } ! /** ! * Gets the attributes in the tag. ! * @return Returns a Hashtable of attributes ! */ ! public Hashtable getAttributes() { Vector attributes; --- 106,171 ---- } ! /** ! * Create a tag with the location and attributes provided ! * @param page The page this tag was read from. * @param start The starting offset of this node within the page. * @param end The ending offset of this node within the page. * @param attributes The list of attributes that were parsed in this tag. * @see Attribute ! */ ! public TagNode (Page page, int start, int end, Vector attributes) ! { ! super (page, start, end); mAttributes = attributes; ! } ! /** ! * In case the tag is parsed at the scan method this will return value of a ! * parameter not implemented yet ! * @param name of parameter ! */ ! public String getAttribute (String name) { ! return ((String)getAttributes().get(name.toUpperCase())); ! } ! /** ! * Set attribute with given key, value pair. ! * @param key ! * @param value ! */ ! public void setAttribute(String key, String value) { ! getAttributes ().put(key,value); ! } ! /** ! * In case the tag is parsed at the scan method this will return value of a ! * parameter not implemented yet ! * @param name of parameter ! * @deprecated use getAttribute instead ! */ ! public String getParameter(String name) { ! return (String)getAttributes().get (name.toUpperCase()); ! } ! ! /** ! * Gets the attributes in the tag. * NOTE: Values of the extended hashtable are two element arrays of String, * with the first element being the original name (not uppercased), * and the second element being the value. ! * @return Returns a special hashtable of attributes in two element String arrays. ! */ ! public Vector getAttributesEx() { ! return mAttributes; ! } ! /** ! * Gets the attributes in the tag. ! * @return Returns a Hashtable of attributes ! */ ! public Hashtable getAttributes() { Vector attributes; *************** *** 217,239 **** return (ret); ! } public String getTagName(){ ! return getParameter(TAGNAME); ! } /** ! * Return the text contained in this tag ! */ ! public String getText() { ! return (mPage.getText (elementBegin () + 1, elementEnd () - 1)); ! } ! /** ! * Sets the attributes. ! * @param attributes The attribute collection to set. ! */ ! public void setAttributes (Hashtable attributes) { Vector att; --- 217,239 ---- return (ret); ! } public String getTagName(){ ! return getParameter(TAGNAME); ! } /** ! * Return the text contained in this tag ! */ ! public String getText() { ! return (mPage.getText (elementBegin () + 1, elementEnd () - 1)); ! } ! /** ! * Sets the attributes. ! * @param attributes The attribute collection to set. ! */ ! public void setAttributes (Hashtable attributes) { Vector att; *************** *** 261,276 **** quote = (char)0; attribute = new Attribute (key, value, quote); ! att.addElement (attribute); } ! this.mAttributes = att; ! } ! /** ! * Sets the attributes. * NOTE: Values of the extended hashtable are two element arrays of String, * with the first element being the original name (not uppercased), * and the second element being the value. ! * @param attribs The attribute collection to set. ! */ public void setAttributesEx (Vector attribs) { --- 261,276 ---- quote = (char)0; attribute = new Attribute (key, value, quote); ! att.addElement (attribute); } ! this.mAttributes = att; ! } ! /** ! * Sets the attributes. * NOTE: Values of the extended hashtable are two element arrays of String, * with the first element being the original name (not uppercased), * and the second element being the value. ! * @param attribs The attribute collection to set. ! */ public void setAttributesEx (Vector attribs) { *************** *** 278,312 **** } ! /** ! * Sets the nodeBegin. ! * @param tagBegin The nodeBegin to set ! */ ! public void setTagBegin(int tagBegin) { ! this.nodeBegin = tagBegin; ! } ! /** ! * Gets the nodeBegin. ! * @return The nodeBegin value. ! */ ! public int getTagBegin() { ! return (nodeBegin); ! } ! ! /** ! * Sets the nodeEnd. ! * @param tagEnd The nodeEnd to set ! */ ! public void setTagEnd(int tagEnd) { ! this.nodeEnd = tagEnd; ! } ! ! /** ! * Gets the nodeEnd. ! * @return The nodeEnd value. ! */ ! public int getTagEnd() { ! return (nodeEnd); ! } public void setText (String text) --- 278,312 ---- } ! /** ! * Sets the nodeBegin. ! * @param tagBegin The nodeBegin to set ! */ ! public void setTagBegin(int tagBegin) { ! this.nodeBegin = tagBegin; ! } ! /** ! * Gets the nodeBegin. ! * @return The nodeBegin value. ! */ ! public int getTagBegin() { ! return (nodeBegin); ! } ! ! /** ! * Sets the nodeEnd. ! * @param tagEnd The nodeEnd to set ! */ ! public void setTagEnd(int tagEnd) { ! this.nodeEnd = tagEnd; ! } ! ! /** ! * Gets the nodeEnd. ! * @return The nodeEnd value. ! */ ! public int getTagEnd() { ! return (nodeEnd); ! } public void setText (String text) *************** *** 324,337 **** public String toPlainTextString() { ! return EMPTY_STRING; ! } ! /** ! * A call to a tag's toHTML() method will render it in HTML. ! * @see org.htmlparser.Node#toHtml() ! */ ! public String toHtml() { ! StringBuffer ret; Vector attributes; Attribute attribute; --- 324,337 ---- public String toPlainTextString() { ! return EMPTY_STRING; ! } ! /** ! * A call to a tag's toHTML() method will render it in HTML. ! * @see org.htmlparser.Node#toHtml() ! */ ! public String toHtml() { ! StringBuffer ret; Vector attributes; Attribute attribute; *************** *** 339,343 **** ret = new StringBuffer (); attributes = getAttributesEx (); ! ret.append ("<"); if (0 < attributes.size ()) { --- 339,343 ---- ret = new StringBuffer (); attributes = getAttributesEx (); ! ret.append ("<"); if (0 < attributes.size ()) { *************** *** 352,367 **** } } ! if (isEmptyXmlTag ()) ret.append ("/"); ! ret.append (">"); ! return (ret.toString ()); } ! /** ! * Print the contents of the tag ! */ ! public String toString() ! { String tag; Cursor start; --- 352,367 ---- } } ! if (isEmptyXmlTag ()) ret.append ("/"); ! ret.append (">"); ! return (ret.toString ()); } ! /** ! * Print the contents of the tag ! */ ! public String toString() ! { String tag; Cursor start; *************** *** 375,380 **** start = new Cursor (getPage (), elementBegin ()); end = new Cursor (getPage (), elementEnd ()); ! return (tag + " (" + start.toString () + "," + end.toString () + "): " + getText ()); ! } /** --- 375,380 ---- start = new Cursor (getPage (), elementBegin ()); end = new Cursor (getPage (), elementEnd ()); ! return (tag + " (" + start.toString () + "," + end.toString () + "): " + getText ()); ! } /** *************** *** 395,446 **** * @see org.htmlparser.Node#collectInto(NodeList, String) */ ! public void collectInto(NodeList collectionList, String filter) { ! } ! /** ! * Returns table of attributes in the tag ! * @return Hashtable ! * @deprecated This method is deprecated. Use getAttributes() instead. ! */ ! public Hashtable getParsed() { ! return getAttributes (); ! } ! /** ! * Sometimes, a scanner may need to request a re-evaluation of the ! * attributes in a tag. This may happen when there is some correction ! * activity. An example of its usage can be found in ImageTag. ! * <br> ! * <B>Note:<B> This is an intensive task, hence call only when ! * really necessary ! * @return Hashtable ! */ ! public Hashtable redoParseAttributes() { mAttributes = null; getAttributesEx (); ! return (getAttributes ()); ! } ! public void accept(Object visitor) { ! } ! public String getType() { ! return TYPE; ! } ! /** ! * Is this an empty xml tag of the form<br> ! * <tag/> ! * @return boolean ! */ ! public boolean isEmptyXmlTag() { ! return emptyXmlTag; ! } ! public void setEmptyXmlTag(boolean emptyXmlTag) { ! this.emptyXmlTag = emptyXmlTag; ! } } --- 395,446 ---- * @see org.htmlparser.Node#collectInto(NodeList, String) */ ! public void collectInto(NodeList collectionList, String filter) { ! } ! /** ! * Returns table of attributes in the tag ! * @return Hashtable ! * @deprecated This method is deprecated. Use getAttributes() instead. ! */ ! public Hashtable getParsed() { ! return getAttributes (); ! } ! /** ! * Sometimes, a scanner may need to request a re-evaluation of the ! * attributes in a tag. This may happen when there is some correction ! * activity. An example of its usage can be found in ImageTag. ! * <br> ! * <B>Note:<B> This is an intensive task, hence call only when ! * really necessary ! * @return Hashtable ! */ ! public Hashtable redoParseAttributes() { mAttributes = null; getAttributesEx (); ! return (getAttributes ()); ! } ! public void accept(Object visitor) { ! } ! public String getType() { ! return TYPE; ! } ! /** ! * Is this an empty xml tag of the form<br> ! * <tag/> ! * @return boolean ! */ ! public boolean isEmptyXmlTag() { ! return emptyXmlTag; ! } ! public void setEmptyXmlTag(boolean emptyXmlTag) { ! this.emptyXmlTag = emptyXmlTag; ! } } |