Package org.htmlparser.tags

Examples of org.htmlparser.tags.Tag


    public void testTagWithSingleQuote() throws ParserException
    {
        createParser("<tag att=\'a<b\'>");
        parseAndAssertNodeCount(1);
        assertType("should be Tag", Tag.class, node[0]);
        Tag tag = (Tag) node[0];
        assertStringEquals("html", "<TAG ATT=\"a<b\">", tag.toHtml());
        assertStringEquals("attribute", "a<b", tag.getAttribute("att"));
    }
View Full Code Here


    public void testMultiLine1() throws ParserException
    {
        createParser("<meta name=\"foo\" content=\"foo<bar>\">");
        parseAndAssertNodeCount(1);
        assertType("should be Tag", Tag.class, node[0]);
        Tag tag = (Tag) node[0];
        String html = tag.toHtml();
        assertStringEquals(
            "html",
            "<META CONTENT=\"foo<bar>\" NAME=\"foo\">",
            html);
        String attribute1 = tag.getAttribute("NAME");
        assertStringEquals("attribute 1", "foo", attribute1);
        String attribute2 = tag.getAttribute("CONTENT");
        assertStringEquals("attribute 2", "foo<bar>", attribute2);
    }
View Full Code Here

    public void testMultiLine2() throws ParserException
    {
        createParser("<meta name=\"foo\" content=\"foo<bar\">");
        parseAndAssertNodeCount(1);
        assertType("should be Tag", Tag.class, node[0]);
        Tag tag = (Tag) node[0];
        String html = tag.toHtml();
        assertStringEquals(
            "html",
            "<META CONTENT=\"foo<bar\" NAME=\"foo\">",
            html);
        String attribute1 = tag.getAttribute("NAME");
        assertStringEquals("attribute 1", "foo", attribute1);
        String attribute2 = tag.getAttribute("CONTENT");
        assertStringEquals("attribute 2", "foo<bar", attribute2);
    }
View Full Code Here

    public void testMultiLine3() throws ParserException
    {
        createParser("<meta name=\"foo\" content=\"foobar>\">");
        parseAndAssertNodeCount(1);
        assertType("should be Tag", Tag.class, node[0]);
        Tag tag = (Tag) node[0];
        String html = tag.toHtml();
        assertStringEquals(
            "html",
            "<META CONTENT=\"foobar>\" NAME=\"foo\">",
            html);
        String attribute1 = tag.getAttribute("NAME");
        assertStringEquals("attribute 1", "foo", attribute1);
        String attribute2 = tag.getAttribute("CONTENT");
        assertStringEquals("attribute 2", "foobar>", attribute2);
    }
View Full Code Here

    public void testMultiLine4() throws ParserException
    {
        createParser("<meta name=\"foo\" content=\"foo\nbar>\">");
        parseAndAssertNodeCount(1);
        assertType("should be Tag", Tag.class, node[0]);
        Tag tag = (Tag) node[0];
        String html = tag.toHtml();
        assertStringEquals(
            "html",
            "<META CONTENT=\"foo\r\nbar>\" NAME=\"foo\">",
            html);
        String attribute1 = tag.getAttribute("NAME");
        assertStringEquals("attribute 1", "foo", attribute1);
        String attribute2 = tag.getAttribute("CONTENT");
        assertStringEquals("attribute 2", "foo\r\nbar>", attribute2);
    }
View Full Code Here

        createParser("<meta name=\"foo\" content=\"<foo>\nbar\">");
        if (1.4 <= Parser.getVersionNumber())
        {
            parseAndAssertNodeCount(1);
            assertType("should be Tag", Tag.class, node[0]);
            Tag tag = (Tag) node[0];
            String html = tag.toHtml();
            assertStringEquals(
                "html",
                "<META CONTENT=\"<foo>\r\nbar\" NAME=\"foo\">",
                html);
            String attribute1 = tag.getAttribute("NAME");
            assertStringEquals("attribute 1", "foo", attribute1);
            String attribute2 = tag.getAttribute("CONTENT");
            assertStringEquals("attribute 2", "<foo>\r\nbar", attribute2);
        }
    }
View Full Code Here

        createParser("<meta name=\"foo\" content=\"foo>\nbar\">");
        if (1.4 <= Parser.getVersionNumber())
        {
            parseAndAssertNodeCount(1);
            assertType("should be Tag", Tag.class, node[0]);
            Tag tag = (Tag) node[0];
            String html = tag.toHtml();
            assertStringEquals(
                "html",
                "<META CONTENT=\"foo>\r\nbar\" NAME=\"foo\">",
                html);
            String attribute1 = tag.getAttribute("NAME");
            assertStringEquals("attribute 1", "foo", attribute1);
            String attribute2 = tag.getAttribute("CONTENT");
            assertStringEquals("attribute 2", "foo>\r\nbar", attribute2);
        }
    }
View Full Code Here

        createParser("<meta name=\"foo\" content=\"<foo\nbar\"");
        if (1.4 <= Parser.getVersionNumber())
        {
            parseAndAssertNodeCount(1);
            assertType("should be Tag", Tag.class, node[0]);
            Tag tag = (Tag) node[0];
            String html = tag.toHtml();
            assertStringEquals(
                "html",
                "<META CONTENT=\"<foo\r\nbar\" NAME=\"foo\">",
                html);
            String attribute1 = tag.getAttribute("NAME");
            assertStringEquals("attribute 1", "foo", attribute1);
            String attribute2 = tag.getAttribute("CONTENT");
            assertStringEquals("attribute 2", "<foo\r\nbar", attribute2);
        }
    }
View Full Code Here

    public static boolean isXMLTagFound(Node node, String tagName)
    {
        boolean xmlTagFound = false;
        if (node instanceof Tag)
        {
            Tag tag = (Tag) node;
            if (tag.getText().toUpperCase().indexOf(tagName) == 0)
            {
                xmlTagFound = true;
            }
        }
        return xmlTagFound;
View Full Code Here

        String url,
        NodeReader reader,
        String currLine)
        throws ParserException
    {
        Tag thisTag = scan(tag, url, reader, currLine);
        thisTag.setThisScanner(this);
        thisTag.setAttributes(tag.getAttributes());
        return thisTag;
    }
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.Tag

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.