[Htmlparser-cvs] htmlparser/src/org/htmlparser/tags CompositeTag.java,1.69,1.70
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-12-20 23:47:58
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags In directory sc8-pr-cvs1:/tmp/cvs-serv12747/org/htmlparser/tags Modified Files: CompositeTag.java Log Message: Reduce recursion on the JVM stack in CompositeTagScanner. Pass a stack of open tags to the scanner. Add smarter tag closing by walking up the stack on encountering an unopened end tag. Avoids a problem with bad HTML such as that found at http://scores.nba.com/games/20031029/scoreboard.html by Shaun Roach. Added testInvalidNesting to CompositeTagScanner Test based on the above. Index: CompositeTag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/CompositeTag.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** CompositeTag.java 16 Dec 2003 02:29:56 -0000 1.69 --- CompositeTag.java 20 Dec 2003 23:47:55 -0000 1.70 *************** *** 374,379 **** } ! public int getChildCount() { ! return (getChildren ().size ()); } --- 374,384 ---- } ! public int getChildCount() ! { ! NodeList children; ! ! children = getChildren (); ! ! return ((null == children) ? 0 : children.size ()); } *************** *** 480,491 **** } } ! // eliminate virtual tags ! // if (!(getEndTag ().getStartPosition () == getEndTag ().getEndPosition ())) ! { ! for (int i = 0; i <= level; i++) ! buffer.append (" "); ! buffer.append (getEndTag ().toString ()); ! buffer.append (System.getProperty ("line.separator")); ! } } } --- 485,498 ---- } } ! ! if (null != getEndTag ()) ! // eliminate virtual tags ! // if (!(getEndTag ().getStartPosition () == getEndTag ().getEndPosition ())) ! { ! for (int i = 0; i <= level; i++) ! buffer.append (" "); ! buffer.append (getEndTag ().toString ()); ! buffer.append (System.getProperty ("line.separator")); ! } } } |