Thread: [Htmlparser-cvs] htmlparser/src/org/htmlparser/tags ImageTag.java,1.44,1.45 LinkTag.java,1.49,1.50 T
Brought to you by:
derrickoswald
From: Derrick O. <der...@us...> - 2004-05-24 00:38:28
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31556/tags Modified Files: ImageTag.java LinkTag.java Tag.java TitleTag.java Log Message: Part two of a multiphase refactoring. Part one added the Tag interface. This submission eliminates some of the duplication between the lexer.nodes package and the htmlparser package by removing the tag specific signatures, visitTitleTag, visitLinkTag and visitImageTag, from the NodeVisitor class. This allows the lexer to return htmlparser level classes for StringNode and RemarkNode. The TagNode is still present in the lexer.nodes package, but will move next. This means that classes derived from NodeVisitor *will not* work using the above signatures; instead a check for tag class (or name) should be performed in visitTag. A document will be added to the visitors package with comprehensive porting instructions. Index: ImageTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/ImageTag.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ImageTag.java 18 Mar 2004 04:04:08 -0000 1.44 --- ImageTag.java 24 May 2004 00:38:17 -0000 1.45 *************** *** 195,210 **** setAttribute ("SRC", imageURL); } - - /** - * Image visiting code. - * Invokes <code>visitImageTag()</code> on the visitor and then - * invokes the normal tag processing. - * @param visitor The <code>NodeVisitor</code> object to invoke - * <code>visitImageTag()</code> on. - */ - public void accept (NodeVisitor visitor) - { - visitor.visitImageTag (this); - super.accept (visitor); - } } --- 195,197 ---- Index: LinkTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/LinkTag.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** LinkTag.java 18 Mar 2004 04:04:08 -0000 1.49 --- LinkTag.java 24 May 2004 00:38:17 -0000 1.50 *************** *** 304,320 **** /** - * Link visiting code. - * Invokes <code>visitLinkTag()</code> on the visitor and then - * invokes the normal tag processing. - * @param visitor The <code>NodeVisitor</code> object to invoke - * <code>visitLinkTag()</code> on. - */ - public void accept (NodeVisitor visitor) - { - visitor.visitLinkTag (this); - super.accept (visitor); - } - - /** * Extract the link from the HREF attribute. * @return The URL from the HREF attibute. This is absolute if the tag has --- 304,307 ---- Index: TitleTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/TitleTag.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** TitleTag.java 2 Jan 2004 16:24:55 -0000 1.33 --- TitleTag.java 24 May 2004 00:38:18 -0000 1.34 *************** *** 95,110 **** return "TITLE: " + getTitle(); } - - /** - * Title visiting code. - * Invokes <code>visitTitleTag()</code> on the visitor and then - * invokes the normal tag processing. - * @param visitor The <code>NodeVisitor</code> object to invoke - * <code>visitTitleTag()</code> on. - */ - public void accept (NodeVisitor visitor) - { - visitor.visitTitleTag (this); - super.accept (visitor); - } } --- 95,97 ---- Index: Tag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Tag.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** Tag.java 28 Feb 2004 15:52:43 -0000 1.62 --- Tag.java 24 May 2004 00:38:18 -0000 1.63 *************** *** 138,167 **** mScanner = scanner; } - - /** - * Handle a visitor. - * <em>NOTE: This currently defers to accept(NodeVisitor). If - * subclasses of Node override accept(Object) directly, they must - * handle the delegation to <code>visitTag()</code> and - * <code>visitEndTag()</code>.</em> - * @param visitor The <code>NodeVisitor</code> object - * (a cast is performed without checking). - */ - public void accept (Object visitor) - { - accept ((NodeVisitor)visitor); - } - - /** - * Default tag visiting code. - * Based on <code>isEndTag()</code>, calls either <code>visitTag()</code> or - * <code>visitEndTag()</code>. - */ - public void accept (NodeVisitor visitor) - { - if (isEndTag ()) - ((NodeVisitor)visitor).visitEndTag (this); - else - ((NodeVisitor)visitor).visitTag (this); - } } --- 138,140 ---- |