Package org.htmlparser.scanners

Examples of org.htmlparser.scanners.ScriptScanner


                            // Taken from org.htmlparser.Parser
        // add input tag scanner
        parser.addScanner(new InputTagScanner());
        // add applet tag scanner
        parser.addScanner(new AppletScanner());
        parser.addScanner(new ScriptScanner());
        parser.addScanner(new LinkTagScanner());
    }
View Full Code Here


    }

    protected void setUp() throws Exception
    {
        super.setUp();
        scriptScanner = new ScriptScanner();
    }
View Full Code Here

    public void testToHTML() throws ParserException
    {
        createParser("<SCRIPT>document.write(d+\".com\")</SCRIPT>");
        // Register the image scanner
        parser.addScanner(new ScriptScanner("-s"));

        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];
View Full Code Here

        String testHTML1 = new String(sb1.toString());

        createParser(testHTML1);
        Parser.setLineSeparator("\r\n");
        // Register the image scanner
        parser.addScanner(new ScriptScanner("-s"));

        StringBuffer sb2 = new StringBuffer();
        sb2.append("<SCRIPT LANGUAGE=\"javascript\">\r\n");
        sb2.append("if(navigator.appName.indexOf(\"Netscape\") != -1)\r\n");
        sb2.append(" document.write ('xxx');\r\n");
View Full Code Here

        sb1.append(" document.write ('yyy');\r\n");
        sb1.append("</script>\r\n");
        createParser(sb1.toString());

        // Register the image scanner
        parser.addScanner(new ScriptScanner("-s"));
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a script tag", node[0] instanceof ScriptTag);
        ScriptTag scriptTag = (ScriptTag) node[0];
        assertEquals("Script Src", "/adb.js", scriptTag.getAttribute("src"));
        assertEquals(
View Full Code Here

        sb1.append("var lower = '<%=lowerValue%>';\n");
        sb1.append("</script>\n");
        createParser(sb1.toString());

        // Register the image scanner
        parser.addScanner(new ScriptScanner("-s"));
        //parser.registerScanners();
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a script tag", node[0] instanceof ScriptTag);
        ScriptTag scriptTag = (ScriptTag) node[0];
        assertStringEquals(
View Full Code Here

        StringBuffer sb1 = new StringBuffer();
        sb1.append("<script src='<%=sourceFileName%>'></script>");
        createParser(sb1.toString());

        // Register the image scanner
        parser.addScanner(new ScriptScanner("-s"));
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a script tag", node[0] instanceof ScriptTag);
        ScriptTag scriptTag = (ScriptTag) node[0];
        assertStringEquals(
            "Script toHTML()",
View Full Code Here

        super(name);
    }

    public void testEvaluate()
    {
        ScriptScanner scanner = new ScriptScanner("-s");
        boolean retVal = scanner.evaluate("   script ", null);
        assertEquals(
            "Evaluation of SCRIPT tag",
            new Boolean(true),
            new Boolean(retVal));
    }
View Full Code Here

    public void testScan() throws ParserException
    {
        String testHtml = "<SCRIPT>document.write(d+\".com\")</SCRIPT>";
        createParser(testHtml, "http://www.google.com/test/index.html");
        // Register the script scanner
        parser.addScanner(new ScriptScanner("-s"));
        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];
        assertStringEquals(
View Full Code Here

    {
        createParser(
            "<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"../js/DetermineBrowser.js\"></SCRIPT>",
            "http://www.google.com/test/index.html");
        // Register the image scanner
        parser.addScanner(new ScriptScanner("-s"));
        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];
        Hashtable table = scriptTag.getAttributes();
View Full Code Here

TOP

Related Classes of org.htmlparser.scanners.ScriptScanner

Copyright © 2018 www.massapicom. 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.