Package org.htmlparser.tags

Examples of org.htmlparser.tags.Tag


    /**
     * This is the reproduction of a bug which causes a null pointer exception
     */
    public void testExtractImageLocnInvertedCommasBug() throws ParserException
    {
        Tag tag =
            new Tag(
                new TagData(
                    0,
                    0,
                    "img width=638 height=53 border=0 usemap=\"#m\" src=http://us.a1.yimg.com/us.yimg.com/i/ww/m5v5.gif alt=Yahoo",
                    ""));
View Full Code Here


        parser.addScanner(new FormScanner(parser));
        parseAndAssertNodeCount(1);
        assertTrue("Node 0 should be Form Tag", node[0] instanceof FormTag);
        FormTag formTag = (FormTag) node[0];

        Tag tag = formTag.searchByName("passwd");
        assertNotNull("Should have found the password node", tag);
        assertType("tag found", InputTag.class, tag);
    }
View Full Code Here

            new CompositeTagScannerHelper(null, null, null, null, null, false);
    }

    public void testIsXmlEndTagForRealXml()
    {
        Tag tag = new Tag(new TagData(0, 0, "something/", ""));
        assertTrue("should be an xml end tag", helper.isXmlEndTag(tag));
    }
View Full Code Here

        assertTrue("should be an xml end tag", helper.isXmlEndTag(tag));
    }

    public void testIsXmlEndTagForFalseMatches()
    {
        Tag tag = new Tag(new TagData(0, 0, "a href=http://someurl.com/", ""));
        assertFalse("should not be an xml end tag", helper.isXmlEndTag(tag));
    }
View Full Code Here

        assertTrue(
            "First node should be a string node",
            node[0] instanceof StringNode);
        assertTrue("Second node should be a Tag", node[1] instanceof Tag);
        StringNode stringNode = (StringNode) node[0];
        Tag tag = (Tag) node[1];
        assertEquals("Text contents", " ", stringNode.getText());
        assertEquals("Tag Contents", "![endif]", tag.getText());

    }
View Full Code Here

        Parser.setLineSeparator("\n");
        parseAndAssertNodeCount(1);
        assertTrue(
            "Node should be a Tag but was " + node[0],
            node[0] instanceof Tag);
        Tag tag = (Tag) node[0];
        assertStringEquals(
            "Expected contents",
            "!\n" + "-\n" + "-\n" + "ssd --",
            tag.getText());
        Parser.setLineSeparator("\r\n");
    }
View Full Code Here

            "<img src=\"http://g-images.amazon.com/images/G/01/merchants/logos/marshall-fields-logo-20.gif\" width=87 height=20 border=0 alt=\"Marshall Field's\">";

        createParser(testHtml);
        parseAndAssertNodeCount(1);
        assertType("should be Tag", Tag.class, node[0]);
        Tag tag = (Tag) node[0];
        assertStringEquals("alt", "Marshall Field's", tag.getAttribute("ALT"));
        assertStringEquals(
            "html",
            "<IMG BORDER=\"0\" ALT=\"Marshall Field's\" WIDTH=\"87\" SRC=\"http://g-images.amazon.com/images/G/01/merchants/logos/marshall-fields-logo-20.gif\" HEIGHT=\"20\">",
            tag.toHtml());
    }
View Full Code Here

    public void testEmptyTag() throws Exception
    {
        createParser("<custom/>");
        parseAndAssertNodeCount(1);
        assertType("should be Tag", Tag.class, node[0]);
        Tag tag = (Tag) node[0];
        assertStringEquals("tag name", "CUSTOM", tag.getTagName());
        assertTrue("empty tag", tag.isEmptyXmlTag());
        assertStringEquals("html", "<CUSTOM/>", tag.toHtml());
    }
View Full Code Here

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

    public void testTagWithOpenTagSymbolInAttribute() throws ParserException
    {
        createParser("<tag att=\"a<b\">");
        parseAndAssertNodeCount(1);
        assertType("should be Tag", Tag.class, node[0]);
        Tag tag = (Tag) node[0];
        assertStringEquals("attribute", "a<b", tag.getAttribute("att"));
    }
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.