[Htmlparser-cvs] htmlparser/src/org/htmlparser/beans StringBean.java,1.27,1.28
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-09-28 15:34:56
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans In directory sc8-pr-cvs1:/tmp/cvs-serv30684/beans Modified Files: StringBean.java Log Message: Lexer Integration Removed old Parser classes. Removed EndTag, this class was replaced by a call to the new isEndTag() method on the Tag class The StringNode, RemarkNode and tags.Tag class now derive from their lexeme counterparts in lexer.nodes instead of the other way around. The beginnings of a node factory interface are included. This was added so the lexer could return 'visitable' nodes to the parser. The parser acts as it's own node factory, as does the Lexer. The node count for parsing goes up in most cases because every whitespace (i.e. newline) now counts as a StringNode. This has whacked out a lot of the tests that were expecting fewer nodes or a certain type of node at a particular index. Attributes now maintain their order and case. The count of attributes also went up because whitespace is maintained within tags too. The storage in a Vector means the element 0 Attribute is actually the name of the tag, rather than having the $TAGNAME entry in a HashTable. Index: StringBean.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/beans/StringBean.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** StringBean.java 22 Sep 2003 02:39:58 -0000 1.27 --- StringBean.java 28 Sep 2003 15:33:57 -0000 1.28 *************** *** 36,40 **** import org.htmlparser.Parser; import org.htmlparser.StringNode; - import org.htmlparser.tags.EndTag; import org.htmlparser.tags.LinkTag; import org.htmlparser.tags.Tag; --- 36,39 ---- *************** *** 600,620 **** /** - * Possibly resets the state of the PRE and SCRIPT flags. - * @param end The end tag. - */ - public void visitEndTag (EndTag end) - { - String name; - - name = end.getTagName (); - if (name.equalsIgnoreCase ("PRE")) - mIsPre = false; - else if (name.equalsIgnoreCase ("SCRIPT")) - mIsScript = false; - } - - /** * Appends a newline to the output if the tag breaks flow, and * possibly sets the state of the PRE and SCRIPT flags. */ public void visitTag (Tag tag) --- 599,606 ---- /** * Appends a newline to the output if the tag breaks flow, and * possibly sets the state of the PRE and SCRIPT flags. + * Possibly resets the state of the PRE and SCRIPT flags if it's + * an end tag. */ public void visitTag (Tag tag) *************** *** 623,632 **** name = tag.getTagName (); ! if (name.equalsIgnoreCase ("PRE")) ! mIsPre = true; ! else if (name.equalsIgnoreCase ("SCRIPT")) ! mIsScript = true; ! if (tag.breaksFlow ()) ! carriage_return (); } --- 609,628 ---- name = tag.getTagName (); ! if (tag.isEndTag ()) ! { ! if (name.equalsIgnoreCase ("/PRE")) ! mIsPre = false; ! else if (name.equalsIgnoreCase ("/SCRIPT")) ! mIsScript = false; ! } ! else ! { ! if (name.equalsIgnoreCase ("PRE")) ! mIsPre = true; ! else if (name.equalsIgnoreCase ("SCRIPT")) ! mIsScript = true; ! if (tag.breaksFlow ()) ! carriage_return (); ! } } |