Examples of ScriptTag


Examples of org.htmlparser.tags.ScriptTag

        // 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();
        String srcExpected = (String) table.get("SRC");
        assertEquals(
            "Expected SRC value",
            "../js/DetermineBrowser.js",
            srcExpected);
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

        sb2.append(" document.write ('yyy');\r\n");
        String testHTML2 = new String(sb2.toString());

        assertTrue("Node should be a script tag", node[1] instanceof ScriptTag);
        // Check the data in the applet tag
        ScriptTag scriptTag = (ScriptTag) node[1];
        String s = scriptTag.getScriptCode();
        assertStringEquals("Expected Script Code", testHTML2, s);
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

        //parser.addScanner(new HTMLScriptScanner("-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("Expected Script Code",testHTML2,scriptTag.getScriptCode());
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

        // Register the image scanner
        parser.registerScanners();
        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();
        String expectedCode =
            "<!--\r\n"
                + "  function validateForm()\r\n"
                + "  {\r\n"
                + "     var i = 10;\r\n"
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

                + "</SCRIPT>";
        createParser(testHtml);

        parser.addScanner(new ScriptScanner("-s"));
        parseAndAssertNodeCount(1);
        ScriptTag scriptTag = (ScriptTag) node[0];
        assertStringEquals("scriptag html", testHtml, scriptTag.toHtml());
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

                + "</body>"
                + "</html>");
        parser.registerScanners();
        Node scriptNodes[] = parser.extractAllNodesThatAre(ScriptTag.class);
        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. "
                + "document.write(\"</script>\");",
            scriptTag.getScriptCode());

    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

                + "width=\"80\" height=\"20\" border=\"0\"></a>\");"
                + "</SCRIPT>");
        parser.registerScanners();
        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());
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

                + "width=\\\"80\\\" height=\\\"20\\\" border=\\\"0\\\"></a>\");"
                + "</SCRIPT>");
        parser.registerScanners();
        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());
    }
View Full Code Here

Examples of org.htmlparser.tags.ScriptTag

        String scriptContents = "alert()\r\nalert()";
        createParser("<script>" + scriptContents + "</script>");
        parser.registerScanners();
        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

    {
        StringNode stringNode =
            new StringNode(new StringBuffer("Script Code"), 0, 0);
        NodeList childVector = new NodeList();
        childVector.add(stringNode);
        ScriptTag scriptTag =
            new ScriptTag(
                new TagData(0, 10, "Tag Contents", "tagline"),
                new CompositeTagData(null, null, childVector));

        assertNotNull("Script Tag object creation", scriptTag);
        assertEquals("Script Tag Begin", 0, scriptTag.elementBegin());
        assertEquals("Script Tag End", 10, scriptTag.elementEnd());
        assertEquals(
            "Script Tag Contents",
            "Tag Contents",
            scriptTag.getText());
        assertEquals(
            "Script Tag Code",
            "Script Code",
            scriptTag.getScriptCode());
        assertEquals("Script Tag Line", "tagline", scriptTag.getTagLine());
    }
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.