[Htmlparser-cvs] htmlparser/src/org/htmlparser/beans StringBean.java,1.39,1.40
Brought to you by:
derrickoswald
From: Derrick O. <der...@us...> - 2004-05-24 00:38:58
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31556/beans Modified Files: StringBean.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: StringBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/StringBean.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** StringBean.java 16 May 2004 17:59:57 -0000 1.39 --- StringBean.java 24 May 2004 00:38:16 -0000 1.40 *************** *** 35,39 **** import org.htmlparser.StringNode; import org.htmlparser.tags.LinkTag; ! import org.htmlparser.tags.Tag; import org.htmlparser.util.ParserException; import org.htmlparser.util.EncodingChangeException; --- 35,39 ---- import org.htmlparser.StringNode; import org.htmlparser.tags.LinkTag; ! import org.htmlparser.Tag; import org.htmlparser.util.ParserException; import org.htmlparser.util.EncodingChangeException; *************** *** 604,621 **** /** - * Appends the link as text between angle brackets to the output. - * @param link The link to process. - */ - public void visitLinkTag (LinkTag link) - { - if (getLinks ()) - { - mBuffer.append ("<"); - mBuffer.append (link.getLink ()); - mBuffer.append (">"); - } - } - - /** * Appends the text to the output. * @param string The text node. --- 604,607 ---- *************** *** 649,652 **** --- 635,645 ---- String name; + if (tag instanceof LinkTag) + if (getLinks ()) + { // appends the link as text between angle brackets to the output. + mBuffer.append ("<"); + mBuffer.append (((LinkTag)tag).getLink ()); + mBuffer.append (">"); + } name = tag.getTagName (); if (name.equalsIgnoreCase ("PRE")) |