Package org.htmlparser.tags

Examples of org.htmlparser.tags.ScriptTag


          if (link.getChild(0) instanceof ImageTag) {
            ImageTag img = (ImageTag) link.getChild(0);
            binUrlStr = img.getImageURL();
          }
        } else if (node instanceof ScriptTag) {
          ScriptTag script = (ScriptTag) node;
          binUrlStr = script.getAttribute("src");
        } else if (node instanceof FrameTag) {
          FrameTag tag = (FrameTag) node;
          binUrlStr = tag.getAttribute("src");
        } else if (node instanceof LinkTagTag) {
          LinkTagTag script = (LinkTagTag) node;
          if (script.getAttribute("rel").equalsIgnoreCase("stylesheet")) {
            binUrlStr = script.getAttribute("href");
          }
        } else if (node instanceof FrameTag) {
          FrameTag script = (FrameTag) node;
          binUrlStr = script.getAttribute("src");
        } else if (node instanceof BgSoundTag) {
          BgSoundTag script = (BgSoundTag) node;
          binUrlStr = script.getAttribute("src");
                } else if (node instanceof Tag) {
                    Tag tag = (Tag) node;
                    String tagname=tag.getTagName();
                    if (tagname.equalsIgnoreCase("EMBED")){
                        binUrlStr = tag.getAttribute("src")
View Full Code Here


    {
        String testHtml = "<SCRIPT>Script Code</SCRIPT>";
        createParser(testHtml,"http://localhost/index.html");
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a script tag",node[0] instanceof ScriptTag);
        ScriptTag scriptTag = (ScriptTag)node[0];
        assertEquals("Script Tag Begin",0,scriptTag.getStartPosition ());
        assertEquals("Script Tag End",28,scriptTag.getEndTag ().getEndPosition ());
        assertEquals("Script Tag Code","Script Code",scriptTag.getScriptCode());
    }
View Full Code Here

    public void testToHTML() throws ParserException {
        createParser("<SCRIPT>document.write(d+\".com\")</SCRIPT>");
        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];
        assertEquals("Expected Raw String","<SCRIPT>document.write(d+\".com\")</SCRIPT>",scriptTag.toHtml());
    }
View Full Code Here

        sb1.append(expectedHTML);
        sb1.append("\r\n");
        String testHTML1 = sb1.toString();

        createParser(testHTML1);
        parser.setNodeFactory (new PrototypicalNodeFactory (new ScriptTag ()));
        parseAndAssertNodeCount(3);
        assertTrue("Node should be a script tag",node[1]
        instanceof ScriptTag);
        // Check the data in the script tag
        ScriptTag scriptTag = (ScriptTag)node[1];
        assertStringEquals("Expected Script Code",expectedHTML,scriptTag.toHtml());
    }
View Full Code Here

        sb1.append(" document.write ('yyy');\r\n");
        sb1.append("</script>\r\n");
        createParser(sb1.toString());
        parseAndAssertNodeCount(2);
        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("Script Language","javascript",scriptTag.getAttribute("language"));
    }
View Full Code Here

        sb1.append("var lower = '<%=lowerValue%>';\n");
        sb1.append("</script>\n");
        createParser(sb1.toString());
        parseAndAssertNodeCount(2);
        assertTrue("Node should be a script tag",node[0] instanceof ScriptTag);
        ScriptTag scriptTag = (ScriptTag)node[0];
        assertStringEquals("Script toHTML()","<script language=\"javascript\">\nvar lower = '<%=lowerValue%>';\n</script>",scriptTag.toHtml());
    }
View Full Code Here

    public void testSingleApostropheParsingBug() throws ParserException {
        String script = "<script src='<%=sourceFileName%>'></script>";
        createParser(script);
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a script tag",node[0] instanceof ScriptTag);
        ScriptTag scriptTag = (ScriptTag)node[0];
        assertStringEquals("Script toHTML()",script,scriptTag.toHtml());
    }
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.ScriptTag

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.