[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/scannersTests AllTests.java,1.47,1.48 AppletSca
Brought to you by:
derrickoswald
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests In directory sc8-pr-cvs1:/tmp/cvs-serv24483/src/org/htmlparser/tests/scannersTests Modified Files: AllTests.java AppletScannerTest.java BaseHREFScannerTest.java BodyScannerTest.java BulletListScannerTest.java BulletScannerTest.java CompositeTagScannerTest.java DivScannerTest.java FormScannerTest.java FrameScannerTest.java FrameSetScannerTest.java HeadScannerTest.java HtmlTest.java ImageScannerTest.java InputTagScannerTest.java JspScannerTest.java LabelScannerTest.java LinkScannerTest.java MetaTagScannerTest.java OptionTagScannerTest.java ScriptScannerTest.java SelectTagScannerTest.java SpanScannerTest.java StyleScannerTest.java TableScannerTest.java TagScannerTest.java TextareaTagScannerTest.java TitleScannerTest.java XmlEndTagScanningTest.java package.html Log Message: Add style checking target to ant build script: ant checkstyle It uses a jar from http://checkstyle.sourceforge.net which is dropped in the lib directory. The rules are in the file htmlparser_checks.xml in the src directory. Added lexerapplications package with Tabby as the first app. It performs whitespace manipulation on source files to follow the style rules. This reduced the number of style violations to roughly 14,000. There are a few issues with the style checker that need to be resolved before it should be taken too seriously. For example: It thinks all method arguments should be final, even if they are modified by the code (which the compiler frowns on). It complains about long lines, even when there is no possibility of wrapping the line, i.e. a URL in a comment that's more than 80 characters long. It considers all naked integers as 'magic numbers', even when they are obvious, i.e. the 4 corners of a box. It complains about whitespace following braces, even in array initializers, i.e. X[][] = { {a, b} { } } But it points out some really interesting things, even if you don't agree with the style guidelines, so it's worth a look. Index: AllTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/AllTests.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** AllTests.java 8 Sep 2003 02:26:31 -0000 1.47 --- AllTests.java 10 Sep 2003 03:38:24 -0000 1.48 *************** *** 18,22 **** // For any questions or suggestions, you can write to me at : // Email :so...@ki... ! // // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha --- 18,22 ---- // For any questions or suggestions, you can write to me at : // Email :so...@ki... ! // // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha *************** *** 31,35 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 31,35 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 38,47 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 38,47 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 51,55 **** import junit.framework.TestSuite; ! public class AllTests extends junit.framework.TestCase { --- 51,55 ---- import junit.framework.TestSuite; ! public class AllTests extends junit.framework.TestCase { *************** *** 57,61 **** super(name); } ! public static TestSuite suite() { TestSuite suite = new TestSuite("Scanner Tests"); --- 57,61 ---- super(name); } ! public static TestSuite suite() { TestSuite suite = new TestSuite("Scanner Tests"); *************** *** 65,73 **** suite.addTestSuite(ImageScannerTest.class); suite.addTestSuite(LinkScannerTest.class); ! suite.addTestSuite(StyleScannerTest.class); ! suite.addTestSuite(MetaTagScannerTest.class); ! suite.addTestSuite(TitleScannerTest.class); ! suite.addTestSuite(FormScannerTest.class); ! suite.addTestSuite(FrameScannerTest.class); suite.addTestSuite(FrameSetScannerTest.class); suite.addTestSuite(InputTagScannerTest.class); --- 65,73 ---- suite.addTestSuite(ImageScannerTest.class); suite.addTestSuite(LinkScannerTest.class); ! suite.addTestSuite(StyleScannerTest.class); ! suite.addTestSuite(MetaTagScannerTest.class); ! suite.addTestSuite(TitleScannerTest.class); ! suite.addTestSuite(FormScannerTest.class); ! suite.addTestSuite(FrameScannerTest.class); suite.addTestSuite(FrameSetScannerTest.class); suite.addTestSuite(InputTagScannerTest.class); *************** *** 76,82 **** suite.addTestSuite(TextareaTagScannerTest.class); suite.addTestSuite(BaseHREFScannerTest.class); ! suite.addTestSuite(JspScannerTest.class); ! suite.addTestSuite(TableScannerTest.class); ! suite.addTestSuite(SpanScannerTest.class); suite.addTestSuite(DivScannerTest.class); suite.addTestSuite(LabelScannerTest.class); --- 76,82 ---- suite.addTestSuite(TextareaTagScannerTest.class); suite.addTestSuite(BaseHREFScannerTest.class); ! suite.addTestSuite(JspScannerTest.class); ! suite.addTestSuite(TableScannerTest.class); ! suite.addTestSuite(SpanScannerTest.class); suite.addTestSuite(DivScannerTest.class); suite.addTestSuite(LabelScannerTest.class); *************** *** 87,91 **** suite.addTestSuite(BulletScannerTest.class); suite.addTestSuite(HtmlTest.class); ! suite.addTestSuite(XmlEndTagScanningTest.class); return suite; } --- 87,91 ---- suite.addTestSuite(BulletScannerTest.class); suite.addTestSuite(HtmlTest.class); ! suite.addTestSuite(XmlEndTagScanningTest.class); return suite; } Index: AppletScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/AppletScannerTest.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** AppletScannerTest.java 8 Sep 2003 02:26:31 -0000 1.25 --- AppletScannerTest.java 10 Sep 2003 03:38:24 -0000 1.26 *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 42,47 **** super(name); } ! ! public void testEvaluate() { AppletScanner scanner = new AppletScanner("-a"); --- 42,47 ---- super(name); } ! ! public void testEvaluate() { AppletScanner scanner = new AppletScanner("-a"); *************** *** 64,71 **** "</HTML>"; createParser(testHTML); ! // Register the applet scanner parser.addScanner(new AppletScanner("-a")); ! parseAndAssertNodeCount(2); assertTrue("Node should be an applet tag",node[0] instanceof AppletTag); --- 64,71 ---- "</HTML>"; createParser(testHTML); ! // Register the applet scanner parser.addScanner(new AppletScanner("-a")); ! parseAndAssertNodeCount(2); assertTrue("Node should be an applet tag",node[0] instanceof AppletTag); Index: BaseHREFScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/BaseHREFScannerTest.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** BaseHREFScannerTest.java 8 Sep 2003 02:26:31 -0000 1.25 --- BaseHREFScannerTest.java 10 Sep 2003 03:38:24 -0000 1.26 *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 44,48 **** super(arg0); } ! protected void setUp() { scanner=new BaseHrefScanner(); --- 44,48 ---- super(arg0); } ! protected void setUp() { scanner=new BaseHrefScanner(); *************** *** 57,68 **** assertEquals("Url2","http://www.google.com",modifiedUrl2); } ! public void testEvaluate() { String testData1 = "BASE HREF=\"http://www.abc.com/\""; assertTrue("Data 1 Should have evaluated true",scanner.evaluate(testData1,null)); String testData2 = "Base href=\"http://www.abc.com/\""; ! assertTrue("Data 2 Should have evaluated true",scanner.evaluate(testData2,null)); } ! public void testScan() throws ParserException{ createParser("<html><head><TITLE>test page</TITLE><BASE HREF=\"http://www.abc.com/\"><a href=\"home.cfm\">Home</a>...</html>","http://www.google.com/test/index.html"); --- 57,68 ---- assertEquals("Url2","http://www.google.com",modifiedUrl2); } ! public void testEvaluate() { String testData1 = "BASE HREF=\"http://www.abc.com/\""; assertTrue("Data 1 Should have evaluated true",scanner.evaluate(testData1,null)); String testData2 = "Base href=\"http://www.abc.com/\""; ! assertTrue("Data 2 Should have evaluated true",scanner.evaluate(testData2,null)); } ! public void testScan() throws ParserException{ createParser("<html><head><TITLE>test page</TITLE><BASE HREF=\"http://www.abc.com/\"><a href=\"home.cfm\">Home</a>...</html>","http://www.google.com/test/index.html"); *************** *** 75,80 **** assertTrue(node[3] instanceof BaseHrefTag); BaseHrefTag baseRefTag = (BaseHrefTag)node[3]; ! assertEquals("Base HREF Url","http://www.abc.com",baseRefTag.getBaseUrl()); } ! } --- 75,80 ---- assertTrue(node[3] instanceof BaseHrefTag); BaseHrefTag baseRefTag = (BaseHrefTag)node[3]; ! assertEquals("Base HREF Url","http://www.abc.com",baseRefTag.getBaseUrl()); } ! } Index: BodyScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/BodyScannerTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BodyScannerTest.java 8 Sep 2003 02:26:31 -0000 1.11 --- BodyScannerTest.java 10 Sep 2003 03:38:24 -0000 1.12 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 56,60 **** assertEquals("Body Scanner",bodyScanner,bodyTag.getThisScanner()); } ! public void testBodywithJsp() throws ParserException { createParser("<html><head><title>Test 1</title></head><body><%=BodyValue%></body></html>"); --- 56,60 ---- assertEquals("Body Scanner",bodyScanner,bodyTag.getThisScanner()); } ! public void testBodywithJsp() throws ParserException { createParser("<html><head><title>Test 1</title></head><body><%=BodyValue%></body></html>"); *************** *** 69,73 **** assertEquals("Body Scanner",bodyScanner,bodyTag.getThisScanner()); } ! public void testBodyMixed() throws ParserException { createParser("<html><head><title>Test 1</title></head><body>before jsp<%=BodyValue%>after jsp</body></html>"); --- 69,73 ---- assertEquals("Body Scanner",bodyScanner,bodyTag.getThisScanner()); } ! public void testBodyMixed() throws ParserException { createParser("<html><head><title>Test 1</title></head><body>before jsp<%=BodyValue%>after jsp</body></html>"); *************** *** 82,86 **** assertEquals("Body Scanner",bodyScanner,bodyTag.getThisScanner()); } ! public void testBodyEnding() throws ParserException { createParser("<html><body>before jsp<%=BodyValue%>after jsp</html>"); --- 82,86 ---- assertEquals("Body Scanner",bodyScanner,bodyTag.getThisScanner()); } ! public void testBodyEnding() throws ParserException { createParser("<html><body>before jsp<%=BodyValue%>after jsp</html>"); *************** *** 95,109 **** assertEquals("Body Scanner",bodyScanner,bodyTag.getThisScanner()); } ! ! public static TestSuite suite() { return new TestSuite(BodyScannerTest.class); } ! ! public static void main(String[] args) { new junit.awtui.TestRunner().start(new String[] {BodyScannerTest.class.getName()}); } ! } --- 95,109 ---- assertEquals("Body Scanner",bodyScanner,bodyTag.getThisScanner()); } ! ! public static TestSuite suite() { return new TestSuite(BodyScannerTest.class); } ! ! public static void main(String[] args) { new junit.awtui.TestRunner().start(new String[] {BodyScannerTest.class.getName()}); } ! } Index: BulletListScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/BulletListScannerTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BulletListScannerTest.java 8 Sep 2003 02:26:31 -0000 1.7 --- BulletListScannerTest.java 10 Sep 2003 03:38:24 -0000 1.8 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 64,72 **** parser.registerScanners(); parseAndAssertNodeCount(1); ! ! NodeList nestedBulletLists = ((CompositeTag)node[0]).searchFor( BulletList.class ! ); assertEquals( "bullets in first list", --- 64,72 ---- parser.registerScanners(); parseAndAssertNodeCount(1); ! ! NodeList nestedBulletLists = ((CompositeTag)node[0]).searchFor( BulletList.class ! ); assertEquals( "bullets in first list", *************** *** 76,80 **** BulletList firstList = (BulletList)nestedBulletLists.elementAt(0); ! Bullet firstBullet = (Bullet)firstList.childAt(0); Node firstNodeInFirstBullet = --- 76,80 ---- BulletList firstList = (BulletList)nestedBulletLists.elementAt(0); ! Bullet firstBullet = (Bullet)firstList.childAt(0); Node firstNodeInFirstBullet = Index: BulletScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/BulletScannerTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** BulletScannerTest.java 8 Sep 2003 02:26:31 -0000 1.8 --- BulletScannerTest.java 10 Sep 2003 03:38:24 -0000 1.9 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 51,56 **** assertType("should be a bullet",Bullet.class,node[0]); } ! ! public void testOutOfMemoryBug() throws ParserException { createParser( --- 51,56 ---- assertType("should be a bullet",Bullet.class,node[0]); } ! ! public void testOutOfMemoryBug() throws ParserException { createParser( *************** *** 71,75 **** "" + "</body>" + ! "</html>" ); parser.registerScanners(); --- 71,75 ---- "" + "</body>" + ! "</html>" ); parser.registerScanners(); *************** *** 78,83 **** System.out.println(node.toHtml()); } ! } ! public void testNonEndedBullets() throws ParserException { createParser( --- 78,83 ---- System.out.println(node.toHtml()); } ! } ! public void testNonEndedBullets() throws ParserException { createParser( Index: CompositeTagScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/CompositeTagScannerTest.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** CompositeTagScannerTest.java 8 Sep 2003 02:26:31 -0000 1.37 --- CompositeTagScannerTest.java 10 Sep 2003 03:38:24 -0000 1.38 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 43,47 **** private CompositeTagScanner scanner; private String url; ! public CompositeTagScannerTest(String name) { super(name); --- 43,47 ---- private CompositeTagScanner scanner; private String url; ! public CompositeTagScannerTest(String name) { super(name); *************** *** 49,56 **** protected void setUp() { ! String [] arr = { "SOMETHING" }; ! scanner = new CompositeTagScanner(arr) { public Tag createTag(TagData tagData, CompositeTagData compositeTagData) throws ParserException { --- 49,56 ---- protected void setUp() { ! String [] arr = { "SOMETHING" }; ! scanner = new CompositeTagScanner(arr) { public Tag createTag(TagData tagData, CompositeTagData compositeTagData) throws ParserException { *************** *** 85,89 **** assertStringEquals("html","<CUSTOM/>",customTag.toHtml()); } ! public void testEmptyCompositeTagAnotherStyle() throws ParserException { createParser( --- 85,89 ---- assertStringEquals("html","<CUSTOM/>",customTag.toHtml()); } ! public void testEmptyCompositeTagAnotherStyle() throws ParserException { createParser( *************** *** 113,117 **** assertEquals("starting line position",1,customTag.tagData.getStartLine()); assertEquals("ending line position",1,customTag.tagData.getEndLine()); ! Node child = customTag.childAt(0); assertType("child",StringNode.class,child); --- 113,117 ---- assertEquals("starting line position",1,customTag.tagData.getStartLine()); assertEquals("ending line position",1,customTag.tagData.getEndLine()); ! Node child = customTag.childAt(0); assertType("child",StringNode.class,child); *************** *** 158,166 **** assertEquals("another tag start pos",8,tag.elementBegin()); assertEquals("another tag ending pos",17,tag.elementEnd()); ! assertEquals("custom end tag start pos",18,customTag.getEndTag().elementBegin()); assertStringEquals("child html","<ANOTHER/>",child.toHtml()); } ! public void testParseTwoCompositeTags() throws ParserException { createParser( --- 158,166 ---- assertEquals("another tag start pos",8,tag.elementBegin()); assertEquals("another tag ending pos",17,tag.elementEnd()); ! assertEquals("custom end tag start pos",18,customTag.getEndTag().elementBegin()); assertStringEquals("child html","<ANOTHER/>",child.toHtml()); } ! public void testParseTwoCompositeTags() throws ParserException { createParser( *************** *** 174,178 **** assertType("tag 2",CustomTag.class,node[1]); } ! public void testXmlTypeCompositeTags() throws ParserException { createParser( --- 174,178 ---- assertType("tag 2",CustomTag.class,node[1]); } ! public void testXmlTypeCompositeTags() throws ParserException { createParser( *************** *** 193,198 **** node = customTag.childAt(1); assertType("second child",CustomTag.class,node); ! } ! public void testCompositeTagWithNestedTag() throws ParserException { createParser( --- 193,198 ---- node = customTag.childAt(1); assertType("second child",CustomTag.class,node); ! } ! public void testCompositeTagWithNestedTag() throws ParserException { createParser( *************** *** 250,254 **** assertEquals("text","Hello",text.toPlainTextString()); } ! public void testErroneousCompositeTag() throws ParserException { createParser("<custom>"); --- 250,254 ---- assertEquals("text","Hello",text.toPlainTextString()); } ! public void testErroneousCompositeTag() throws ParserException { createParser("<custom>"); *************** *** 260,264 **** assertEquals("starting line position",1,customTag.tagData.getStartLine()); assertEquals("ending line position",1,customTag.tagData.getEndLine()); ! assertStringEquals("html","<CUSTOM></CUSTOM>",customTag.toHtml()); } --- 260,264 ---- assertEquals("starting line position",1,customTag.tagData.getStartLine()); assertEquals("ending line position",1,customTag.tagData.getEndLine()); ! assertStringEquals("html","<CUSTOM></CUSTOM>",customTag.toHtml()); } *************** *** 276,282 **** assertEquals("starting line position",1,customTag.tagData.getStartLine()); assertEquals("ending line position",1,customTag.tagData.getEndLine()); ! assertStringEquals("html","<CUSTOM><FIRSTCHILD><SECONDCHILD></CUSTOM>",customTag.toHtml()); } ! public void testErroneousCompositeTagWithChildrenAndLineBreak() throws ParserException { createParser( --- 276,282 ---- assertEquals("starting line position",1,customTag.tagData.getStartLine()); assertEquals("ending line position",1,customTag.tagData.getEndLine()); ! assertStringEquals("html","<CUSTOM><FIRSTCHILD><SECONDCHILD></CUSTOM>",customTag.toHtml()); } ! public void testErroneousCompositeTagWithChildrenAndLineBreak() throws ParserException { createParser( *************** *** 298,304 **** "</CUSTOM>", customTag.toHtml() ! ); } ! public void testTwoConsecutiveErroneousCompositeTags() throws ParserException { createParser( --- 298,304 ---- "</CUSTOM>", customTag.toHtml() ! ); } ! public void testTwoConsecutiveErroneousCompositeTags() throws ParserException { createParser( *************** *** 320,324 **** "<CUSTOM>something</CUSTOM>", customTag.toHtml() ! ); customTag = (CustomTag)node[1]; assertStringEquals( --- 320,324 ---- "<CUSTOM>something</CUSTOM>", customTag.toHtml() ! ); customTag = (CustomTag)node[1]; assertStringEquals( *************** *** 328,332 **** ); } ! public void testCompositeTagWithErroneousAnotherTagAndLineBreak() throws ParserException { createParser( --- 328,332 ---- ); } ! public void testCompositeTagWithErroneousAnotherTagAndLineBreak() throws ParserException { createParser( *************** *** 340,344 **** AnotherTag anotherTag = (AnotherTag)node[0]; assertEquals("another tag child count",0,anotherTag.getChildCount()); ! CustomTag customTag = (CustomTag)node[1]; assertEquals("child count",0,customTag.getChildCount()); --- 340,344 ---- AnotherTag anotherTag = (AnotherTag)node[0]; assertEquals("another tag child count",0,anotherTag.getChildCount()); ! CustomTag customTag = (CustomTag)node[1]; assertEquals("child count",0,customTag.getChildCount()); *************** *** 349,353 **** assertEquals("ending line position",2,customTag.tagData.getEndLine()); assertStringEquals("another tag html","<ANOTHER></ANOTHER>",anotherTag.toHtml()); ! assertStringEquals("custom tag html","<CUSTOM>\r\n</CUSTOM>",customTag.toHtml()); } --- 349,353 ---- assertEquals("ending line position",2,customTag.tagData.getEndLine()); assertStringEquals("another tag html","<ANOTHER></ANOTHER>",anotherTag.toHtml()); ! assertStringEquals("custom tag html","<CUSTOM>\r\n</CUSTOM>",customTag.toHtml()); } *************** *** 368,372 **** assertEquals("starting line position",1,customTag.tagData.getStartLine()); assertEquals("ending line position",1,customTag.tagData.getEndLine()); ! assertStringEquals("html","<CUSTOM><ANOTHER></ANOTHER></CUSTOM>",customTag.toHtml()); } --- 368,372 ---- assertEquals("starting line position",1,customTag.tagData.getStartLine()); assertEquals("ending line position",1,customTag.tagData.getEndLine()); ! assertStringEquals("html","<CUSTOM><ANOTHER></ANOTHER></CUSTOM>",customTag.toHtml()); } *************** *** 396,400 **** "<CUSTOM><ANOTHER>something</ANOTHER></CUSTOM>", customTag.toHtml() ! ); customTag = (CustomTag)node[1]; assertStringEquals( --- 396,400 ---- "<CUSTOM><ANOTHER>something</ANOTHER></CUSTOM>", customTag.toHtml() ! ); customTag = (CustomTag)node[1]; assertStringEquals( *************** *** 422,427 **** assertEquals("custom end tag begin loc",10,customTag.getEndTag().elementBegin()); assertEquals("custom end tag end loc",8,customTag.getEndTag().elementEnd()); ! } ! public void testCompositeTagWithSelfChildren() throws ParserException { createParser( --- 422,427 ---- assertEquals("custom end tag begin loc",10,customTag.getEndTag().elementBegin()); assertEquals("custom end tag end loc",8,customTag.getEndTag().elementEnd()); ! } ! public void testCompositeTagWithSelfChildren() throws ParserException { createParser( *************** *** 433,441 **** parser.addScanner(new AnotherScanner()); parseAndAssertNodeCount(3); ! CustomTag customTag = (CustomTag)node[0]; assertEquals("child count",0,customTag.getChildCount()); assertFalse("custom tag should not be xml end tag",customTag.isEmptyXmlTag()); ! assertStringEquals( "first custom tag html", --- 433,441 ---- parser.addScanner(new AnotherScanner()); parseAndAssertNodeCount(3); ! CustomTag customTag = (CustomTag)node[0]; assertEquals("child count",0,customTag.getChildCount()); assertFalse("custom tag should not be xml end tag",customTag.isEmptyXmlTag()); ! assertStringEquals( "first custom tag html", *************** *** 456,460 **** ); } ! public void testParentConnections() throws ParserException { createParser( --- 456,460 ---- ); } ! public void testParentConnections() throws ParserException { createParser( *************** *** 466,472 **** parser.addScanner(new AnotherScanner()); parseAndAssertNodeCount(3); ! CustomTag customTag = (CustomTag)node[0]; ! assertStringEquals( "first custom tag html", --- 466,472 ---- parser.addScanner(new AnotherScanner()); parseAndAssertNodeCount(3); ! CustomTag customTag = (CustomTag)node[0]; ! assertStringEquals( "first custom tag html", *************** *** 478,482 **** customTag.getParent() ); ! customTag = (CustomTag)node[1]; assertStringEquals( --- 478,482 ---- customTag.getParent() ); ! customTag = (CustomTag)node[1]; assertStringEquals( *************** *** 489,493 **** customTag.getParent() ); ! Node firstChild = customTag.childAt(0); assertType("firstChild",StringNode.class,firstChild); --- 489,493 ---- customTag.getParent() ); ! Node firstChild = customTag.childAt(0); assertType("firstChild",StringNode.class,firstChild); *************** *** 495,499 **** assertNotNull("first child parent should not be null",parent); assertSame("parent and custom tag should be the same",customTag,parent); ! EndTag endTag = (EndTag)node[2]; assertStringEquals( --- 495,499 ---- assertNotNull("first child parent should not be null",parent); assertSame("parent and custom tag should be the same",customTag,parent); ! EndTag endTag = (EndTag)node[2]; assertStringEquals( *************** *** 508,515 **** } ! public void testUrlBeingProvidedToCreateTag() throws ParserException { createParser("<Custom/>","http://www.yahoo.com"); ! parser.addScanner(new CustomScanner() { public Tag createTag( --- 508,515 ---- } ! public void testUrlBeingProvidedToCreateTag() throws ParserException { createParser("<Custom/>","http://www.yahoo.com"); ! parser.addScanner(new CustomScanner() { public Tag createTag( *************** *** 524,528 **** }); parseAndAssertNodeCount(1); ! assertStringEquals("url","http://www.yahoo.com",url); } --- 524,528 ---- }); parseAndAssertNodeCount(1); ! assertStringEquals("url","http://www.yahoo.com",url); } *************** *** 560,564 **** "<custom>\n" + "Hey\n" + ! "</custom>" ); parser.addScanner(new CustomScanner(false)); --- 560,564 ---- "<custom>\n" + "Hey\n" + ! "</custom>" ); parser.addScanner(new CustomScanner(false)); *************** *** 568,605 **** } } ! public static class CustomScanner extends CompositeTagScanner { private static final String MATCH_NAME [] = { "CUSTOM" }; ! public CustomScanner() { ! this(true); } ! ! public CustomScanner(boolean selfChildrenAllowed) { ! super("", MATCH_NAME, new String[] {}, selfChildrenAllowed); } ! ! public String[] getID() { ! return MATCH_NAME; } ! public Tag createTag(TagData tagData, CompositeTagData compositeTagData) { return new CustomTag(tagData, compositeTagData); } } ! public static class AnotherScanner extends CompositeTagScanner { private static final String MATCH_NAME [] = { "ANOTHER" }; ! public AnotherScanner() { ! super("", MATCH_NAME, new String[] {"CUSTOM"}); } ! ! public AnotherScanner(boolean acceptCustomTagsButDontAcceptCustomEndTags) { ! super("", MATCH_NAME, new String[] {}, new String[] {"CUSTOM"}, true); } ! ! public String[] getID() { ! return MATCH_NAME; } ! public Tag createTag(TagData tagData, CompositeTagData compositeTagData) { return new AnotherTag(tagData, compositeTagData); --- 568,605 ---- } } ! public static class CustomScanner extends CompositeTagScanner { private static final String MATCH_NAME [] = { "CUSTOM" }; ! public CustomScanner() { ! this(true); } ! ! public CustomScanner(boolean selfChildrenAllowed) { ! super("", MATCH_NAME, new String[] {}, selfChildrenAllowed); } ! ! public String[] getID() { ! return MATCH_NAME; } ! public Tag createTag(TagData tagData, CompositeTagData compositeTagData) { return new CustomTag(tagData, compositeTagData); } } ! public static class AnotherScanner extends CompositeTagScanner { private static final String MATCH_NAME [] = { "ANOTHER" }; ! public AnotherScanner() { ! super("", MATCH_NAME, new String[] {"CUSTOM"}); } ! ! public AnotherScanner(boolean acceptCustomTagsButDontAcceptCustomEndTags) { ! super("", MATCH_NAME, new String[] {}, new String[] {"CUSTOM"}, true); } ! ! public String[] getID() { ! return MATCH_NAME; } ! public Tag createTag(TagData tagData, CompositeTagData compositeTagData) { return new AnotherTag(tagData, compositeTagData); *************** *** 608,612 **** return false; } ! } --- 608,612 ---- return false; } ! } *************** *** 618,622 **** } } ! public static class AnotherTag extends CompositeTag { public AnotherTag(TagData tagData, CompositeTagData compositeTagData) { --- 618,622 ---- } } ! public static class AnotherTag extends CompositeTag { public AnotherTag(TagData tagData, CompositeTagData compositeTagData) { Index: DivScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/DivScannerTest.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** DivScannerTest.java 8 Sep 2003 02:26:31 -0000 1.31 --- DivScannerTest.java 10 Sep 2003 03:38:24 -0000 1.32 *************** *** 1,27 **** // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha ! // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. ! // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! // // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 1,27 ---- // HTMLParser Library v1_4_20030907 - A java-based parser for HTML // Copyright (C) Dec 31, 2000 Somik Raha ! // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. ! // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! // // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com Index: FormScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/FormScannerTest.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** FormScannerTest.java 8 Sep 2003 02:26:31 -0000 1.31 --- FormScannerTest.java 10 Sep 2003 03:38:24 -0000 1.32 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 60,66 **** "<INPUT TYPE=\"submit\">\n"+ "</FORM>"; ! public static final String EXPECTED_FORM_HTML_FORMLINE="<FORM ACTION=\"http://www.google.com/test/do_login.php\" NAME=\"login_form\" ONSUBMIT=\"return CheckData()\" METHOD=\""+FormTag.POST+"\">\r\n"; ! public static final String EXPECTED_FORM_HTML_REST_OF_FORM= "<TR><TD ALIGN=\"center\"> </TD></TR>\r\n"+ "<TR><TD ALIGN=\"center\"><FONT FACE=\"Arial, verdana\" SIZE=\"2\"><B>User Name</B></FONT></TD></TR>\r\n"+ --- 60,66 ---- "<INPUT TYPE=\"submit\">\n"+ "</FORM>"; ! public static final String EXPECTED_FORM_HTML_FORMLINE="<FORM ACTION=\"http://www.google.com/test/do_login.php\" NAME=\"login_form\" ONSUBMIT=\"return CheckData()\" METHOD=\""+FormTag.POST+"\">\r\n"; ! public static final String EXPECTED_FORM_HTML_REST_OF_FORM= "<TR><TD ALIGN=\"center\"> </TD></TR>\r\n"+ "<TR><TD ALIGN=\"center\"><FONT FACE=\"Arial, verdana\" SIZE=\"2\"><B>User Name</B></FONT></TD></TR>\r\n"+ *************** *** 77,86 **** "</FORM>"; public static final String EXPECTED_FORM_HTML = EXPECTED_FORM_HTML_FORMLINE+EXPECTED_FORM_HTML_REST_OF_FORM; ! public FormScannerTest(String name) { super(name); } ! ! public void testEvaluate() { String line1="form method=\"post\" onsubmit=\"return implementsearch()\" name=frmsearch id=form"; String line2="FORM method=\"post\" onsubmit=\"return implementsearch()\" name=frmsearch id=form"; --- 77,86 ---- "</FORM>"; public static final String EXPECTED_FORM_HTML = EXPECTED_FORM_HTML_FORMLINE+EXPECTED_FORM_HTML_REST_OF_FORM; ! public FormScannerTest(String name) { super(name); } ! ! public void testEvaluate() { String line1="form method=\"post\" onsubmit=\"return implementsearch()\" name=frmsearch id=form"; String line2="FORM method=\"post\" onsubmit=\"return implementsearch()\" name=frmsearch id=form"; *************** *** 91,95 **** assertTrue("Line 3",formScanner.evaluate(line3,null)); } ! public void assertTypeNameSize(String description,String type,String name,String size,InputTag inputTag) { assertEquals(description+" type",type,inputTag.getAttribute("TYPE")); --- 91,95 ---- assertTrue("Line 3",formScanner.evaluate(line3,null)); } ! public void assertTypeNameSize(String description,String type,String name,String size,InputTag inputTag) { assertEquals(description+" type",type,inputTag.getAttribute("TYPE")); *************** *** 101,105 **** assertEquals(description+" name",name,inputTag.getAttribute("NAME")); assertEquals(description+" value",value,inputTag.getAttribute("VALUE")); ! } public void testScan() throws ParserException { createParser(FORM_HTML,"http://www.google.com/test/index.html"); --- 101,105 ---- assertEquals(description+" name",name,inputTag.getAttribute("NAME")); assertEquals(description+" value",value,inputTag.getAttribute("VALUE")); ! } public void testScan() throws ParserException { createParser(FORM_HTML,"http://www.google.com/test/index.html"); *************** *** 110,114 **** assertStringEquals("Method",FormTag.POST,formTag.getFormMethod()); assertStringEquals("Location","http://www.google.com/test/do_login.php",formTag.getFormLocation()); ! assertStringEquals("Name","login_form",formTag.getFormName()); InputTag nameTag = formTag.getInputTag("name"); InputTag passwdTag = formTag.getInputTag("passwd"); --- 110,114 ---- assertStringEquals("Method",FormTag.POST,formTag.getFormMethod()); assertStringEquals("Location","http://www.google.com/test/do_login.php",formTag.getFormLocation()); ! assertStringEquals("Name","login_form",formTag.getFormName()); InputTag nameTag = formTag.getInputTag("name"); InputTag passwdTag = formTag.getInputTag("passwd"); *************** *** 119,135 **** assertNotNull("Input Submit Tag should not be null",submitTag); assertNull("Input dummy tag should be null",dummyTag); ! assertTypeNameSize("Input Name Tag","text","name","20",nameTag); assertTypeNameSize("Input Password Tag","password","passwd","20",passwdTag); assertTypeNameValue("Input Submit Tag","submit","submit","Login",submitTag); ! TextareaTag textAreaTag = formTag.getTextAreaTag("Description"); assertNotNull("Text Area Tag should have been found",textAreaTag); assertEquals("Text Area Tag Contents","Contents of TextArea",textAreaTag.getValue()); assertNull("Should have been null",formTag.getTextAreaTag("junk")); ! assertStringEquals("toHTML",EXPECTED_FORM_HTML,formTag.toHtml()); } ! public void testScanFormWithNoEnding() throws Exception { createParser( --- 119,135 ---- assertNotNull("Input Submit Tag should not be null",submitTag); assertNull("Input dummy tag should be null",dummyTag); ! assertTypeNameSize("Input Name Tag","text","name","20",nameTag); assertTypeNameSize("Input Password Tag","password","passwd","20",passwdTag); assertTypeNameValue("Input Submit Tag","submit","submit","Login",submitTag); ! TextareaTag textAreaTag = formTag.getTextAreaTag("Description"); assertNotNull("Text Area Tag should have been found",textAreaTag); assertEquals("Text Area Tag Contents","Contents of TextArea",textAreaTag.getValue()); assertNull("Should have been null",formTag.getTextAreaTag("junk")); ! assertStringEquals("toHTML",EXPECTED_FORM_HTML,formTag.toHtml()); } ! public void testScanFormWithNoEnding() throws Exception { createParser( *************** *** 146,155 **** "<INPUT TYPE=\"hidden\" NAME=\"password\" SIZE=\"20\">\n"+ "</TABLE>","http://www.google.com/test/index.html"); ! parser.addScanner(new FormScanner("",parser)); ! parseAndAssertNodeCount(2); } ! /** * Bug reported by Pavan Podila - forms with links are not being parsed * Sample html is from google --- 146,155 ---- "<INPUT TYPE=\"hidden\" NAME=\"password\" SIZE=\"20\">\n"+ "</TABLE>","http://www.google.com/test/index.html"); ! parser.addScanner(new FormScanner("",parser)); ! parseAndAssertNodeCount(2); } ! /** * Bug reported by Pavan Podila - forms with links are not being parsed * Sample html is from google *************** *** 165,170 **** " <a href=/preferences?hl=en>Preferences</a><br> • <a href=/"+ "language_tools?hl=en>Language Tools</a></font></td></tr></table></form>" ! ); ! parser.addScanner(new FormScanner("",parser)); parser.addScanner(new LinkScanner()); --- 165,170 ---- " <a href=/preferences?hl=en>Preferences</a><br> • <a href=/"+ "language_tools?hl=en>Language Tools</a></font></td></tr></table></form>" ! ); ! parser.addScanner(new FormScanner("",parser)); parser.addScanner(new LinkScanner()); *************** *** 177,181 **** Node formNode = e.nextNode(); if (formNode instanceof LinkTag) { ! linkTag[i++] = (LinkTag)formNode; } } --- 177,181 ---- Node formNode = e.nextNode(); if (formNode instanceof LinkTag) { ! linkTag[i++] = (LinkTag)formNode; } } *************** *** 185,189 **** assertEquals("Third Link Tag Text","Language Tools",linkTag[2].getLinkText()); } ! /** * Bug 652674 - forms with comments are not being parsed */ --- 185,189 ---- assertEquals("Third Link Tag Text","Language Tools",linkTag[2].getLinkText()); } ! /** * Bug 652674 - forms with comments are not being parsed */ *************** *** 199,204 **** " <a href=/preferences?hl=en>Preferences</a><br> • <a href=/"+ "language_tools?hl=en>Language Tools</a></font></td></tr></table></form>" ! ); ! parser.addScanner(new FormScanner("",parser)); parseAndAssertNodeCount(1); --- 199,204 ---- " <a href=/preferences?hl=en>Preferences</a><br> • <a href=/"+ "language_tools?hl=en>Language Tools</a></font></td></tr></table></form>" ! ); ! parser.addScanner(new FormScanner("",parser)); parseAndAssertNodeCount(1); *************** *** 210,225 **** Node formNode = (Node)e.nextNode(); if (formNode instanceof RemarkNode) { ! remarkNode[i++] = (RemarkNode)formNode; } } assertEquals("Remark Node Count",1,i); assertEquals("First Remark Node"," Hello World ",remarkNode[0].toPlainTextString()); ! } ! /** * Bug 652674 - forms with comments are not being parsed */ public void testScanFormWithComments2() throws ParserException { createParser( ! "<FORM id=\"id\" name=\"name\" action=\"http://some.site/aPage.asp?id=97\" method=\"post\">\n"+ " <!--\n"+ " Just a Comment\n"+ --- 210,225 ---- Node formNode = (Node)e.nextNode(); if (formNode instanceof RemarkNode) { ! remarkNode[i++] = (RemarkNode)formNode; } } assertEquals("Remark Node Count",1,i); assertEquals("First Remark Node"," Hello World ",remarkNode[0].toPlainTextString()); ! } ! /** * Bug 652674 - forms with comments are not being parsed */ public void testScanFormWithComments2() throws ParserException { createParser( ! "<FORM id=\"id\" name=\"name\" action=\"http://some.site/aPage.asp?id=97\" method=\"post\">\n"+ " <!--\n"+ " Just a Comment\n"+ *************** *** 235,244 **** Node formNode = (Node)e.nextNode(); if (formNode instanceof RemarkNode) { ! remarkNode[i++] = (RemarkNode)formNode; } } assertEquals("Remark Node Count",1,i); ! } ! /** * Bug 656870 - a form tag with a previously open link causes infinite loop --- 235,244 ---- Node formNode = (Node)e.nextNode(); if (formNode instanceof RemarkNode) { ! remarkNode[i++] = (RemarkNode)formNode; } } assertEquals("Remark Node Count",1,i); ! } ! /** * Bug 656870 - a form tag with a previously open link causes infinite loop *************** *** 272,276 **** /** ! * Bug 713907 reported by Dhaval Udani, erroneous * parsing of form tag (even when form scanner is not * registered) --- 272,276 ---- /** ! * Bug 713907 reported by Dhaval Udani, erroneous * parsing of form tag (even when form scanner is not * registered) *************** *** 296,300 **** ); } ! /** * See bug #745566 StackOverflowError on select with too many unclosed options. --- 296,300 ---- ); } ! /** * See bug #745566 StackOverflowError on select with too many unclosed options. *************** *** 306,310 **** int i; Node[] nodes; ! parser = new Parser(url); parser.registerScanners (); --- 306,310 ---- int i; Node[] nodes; ! parser = new Parser(url); parser.registerScanners (); Index: FrameScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/FrameScannerTest.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** FrameScannerTest.java 8 Sep 2003 02:26:31 -0000 1.25 --- FrameScannerTest.java 10 Sep 2003 03:38:24 -0000 1.26 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 39,65 **** super(name); } ! public void testScan() throws ParserException { createParser( ! "<frameset rows=\"115,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">\n"+ "<frame name=\"topFrame\" noresize src=\"demo_bc_top.html\" scrolling=\"NO\" frameborder=\"NO\">\n"+ "<frame name=\"mainFrame\" src=\"http://www.kizna.com/web_e/\" scrolling=\"AUTO\">\n"+ "</frameset>","http://www.google.com/test/index.html"); ! parser.addScanner(new FrameScanner("")); ! parseAndAssertNodeCount(4); ! assertTrue("Node 1 should be Frame Tag",node[1] instanceof FrameTag); assertTrue("Node 2 should be Frame Tag",node[2] instanceof FrameTag); FrameTag frameTag1 = (FrameTag)node[1]; ! FrameTag frameTag2 = (FrameTag)node[2]; assertEquals("Frame 1 Locn","http://www.google.com/test/demo_bc_top.html",frameTag1.getFrameLocation()); assertEquals("Frame 1 Name","topFrame",frameTag1.getFrameName()); ! assertEquals("Frame 2 Locn","http://www.kizna.com/web_e/",frameTag2.getFrameLocation()); assertEquals("Frame 2 Name","mainFrame",frameTag2.getFrameName()); assertEquals("Frame 1 Scrolling","NO",frameTag1.getAttribute("scrolling")); ! assertEquals("Frame 1 Border","NO",frameTag1.getAttribute("frameborder")); } } --- 39,65 ---- super(name); } ! public void testScan() throws ParserException { createParser( ! "<frameset rows=\"115,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">\n"+ "<frame name=\"topFrame\" noresize src=\"demo_bc_top.html\" scrolling=\"NO\" frameborder=\"NO\">\n"+ "<frame name=\"mainFrame\" src=\"http://www.kizna.com/web_e/\" scrolling=\"AUTO\">\n"+ "</frameset>","http://www.google.com/test/index.html"); ! parser.addScanner(new FrameScanner("")); ! parseAndAssertNodeCount(4); ! assertTrue("Node 1 should be Frame Tag",node[1] instanceof FrameTag); assertTrue("Node 2 should be Frame Tag",node[2] i... [truncated message content] |