Examples of ScriptTag


Examples of org.htmlparser.tags.ScriptTag

        String src = "../js/DetermineBrowser.js";
        createParser("<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"" + src + "\"></SCRIPT>","http://www.google.com/test/index.html");
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a script tag",node[0] instanceof ScriptTag);
        // Check the data in the applet tag
        ScriptTag scriptTag = (ScriptTag)node[0];
        String srcExpected = scriptTag.getAttribute ("SRC");;
        assertEquals("Expected SRC value",src,srcExpected);
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

        assertTrue("Node should be a body tag", node[0] instanceof BodyTag);
        BodyTag body = (BodyTag)node[0];
        assertTrue("Node should have one child", 1 == body.getChildCount ());
        assertTrue("Child should be a script tag", body.getChild (0) instanceof ScriptTag);
        // Check the data in the script tag
        ScriptTag scriptTag = (ScriptTag)body.getChild (0);
        String s = scriptTag.getScriptCode();
        assertStringEquals("Expected Script Code",testHTML2,s);
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

                          "</SCRIPT>","http://www.hardwareextreme.com/");
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a script tag",node[0]
        instanceof ScriptTag);
        // Check the data in the applet tag
        ScriptTag scriptTag = (ScriptTag)node[0];
        String scriptCode = scriptTag.getScriptCode();
        assertStringEquals("Expected Code",expectedCode,scriptCode);
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

            "<!--\r\n"+
            "// -->\r\n"+
        "</SCRIPT>";
        createParser(testHtml);
        parseAndAssertNodeCount(1);
        ScriptTag scriptTag = (ScriptTag)node[0];
        assertStringEquals("scriptag html",testHtml,scriptTag.toHtml());
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

            assertType(
                "scriptnode",
                ScriptTag.class,
                scriptNodes[0]
            );
            ScriptTag scriptTag = (ScriptTag)scriptNodes[0];
            assertStringEquals(
                "script code",
                "document.write(\"<script " +
                "language=\\\"JavaScript\\\">\");" +
                "document.write(\"function onmousedown" +
                "(event)\");" +
                "document.write(\"{ // do something\"); " +
                "document.write(\"}\"); " +
                "// parser thinks this is the end tag.\n" +
                "document.write(\"</script>\");",
                scriptTag.getScriptCode()
            );
        }
        finally
        {
            org.htmlparser.scanners.ScriptScanner.STRICT = old_strict;
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

                "width=\"80\" height=\"20\" border=\"0\"></a>\");" +
                "</SCRIPT>"
            );
            parseAndAssertNodeCount(1);
            assertType("script",ScriptTag.class,node[0]);
            ScriptTag scriptTag = (ScriptTag)node[0];
            assertStringEquals(
                "script code",
                "document.write(\"<a href=\"1.htm\"><img src=\"1.jpg\" " +
                "width=\"80\" height=\"20\" border=\"0\"></a>\");",
                scriptTag.getScriptCode()
            );
        }
        finally
        {
            org.htmlparser.scanners.ScriptScanner.STRICT = old_strict;
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

                "width=\\\"80\\\" height=\\\"20\\\" border=\\\"0\\\"></a>\");" +
                "</SCRIPT>"
            );
            parseAndAssertNodeCount(1);
            assertType("script",ScriptTag.class,node[0]);
            ScriptTag scriptTag = (ScriptTag)node[0];
            assertStringEquals(
                "script code",
                "document.write(\"<a href=\\\"1.htm\\\"><img src=\\\"1.jpg\\\" " +
                "width=\\\"80\\\" height=\\\"20\\\" border=\\\"0\\\"></a>\");",
                scriptTag.getScriptCode()
            );
        }
        finally
        {
            org.htmlparser.scanners.ScriptScanner.STRICT = old_strict;
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

    public void testScriptCodeExtractionWithNewlines() throws ParserException {
        String scriptContents = "alert()\r\nalert()";
        createParser("<script>" + scriptContents + "</script>");
        parseAndAssertNodeCount(1);
        assertType("script",ScriptTag.class,node[0]);
        ScriptTag scriptTag = (ScriptTag)node[0];
        assertStringEquals(
            "script code",
            scriptContents,
            scriptTag.getScriptCode()
        );
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

    public void testScanScriptWithTagsInComment() throws ParserException {
        String javascript = "\n// This is javascript with <li> tag in the comment\n";
        createParser("<script>"+ javascript + "</script>");
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a script tag",node[0] instanceof ScriptTag);
        ScriptTag scriptTag = (ScriptTag)node[0];
        String scriptCode = scriptTag.getScriptCode();
        assertStringEquals("Expected Code",javascript,scriptCode);
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

            "var s = \"This is a string \\\n" +
            "that spans multiple lines;\"\n";
        createParser("<script>"+ javascript + "</script>");
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a script tag",node[0] instanceof ScriptTag);
        ScriptTag scriptTag = (ScriptTag)node[0];
        String scriptCode = scriptTag.getScriptCode();
        assertStringEquals("Expected Code",javascript,scriptCode);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.