Examples of StringNode


Examples of org.htmlparser.StringNode

     */
    public void testParseParameterG() throws ParserException
    {
        Tag tag;
        EndTag etag;
        StringNode snode;
        Node node = null;
        String lin1 =
            "<G href=\"http://www.iki.fi/kaila\" myParameter yourParameter=\"Kaila\">Kaarle's homepage</G><p>Paragraph</p>";
        createParser(lin1);
        NodeIterator en = parser.elements();
        Hashtable h;
        boolean testEnd = true; // test end of first part
        String a, href, myPara, myValue, nice;

        try
        {

            if (en.hasMoreNodes())
            {
                node = en.nextNode();

                tag = (Tag) node;
                h = tag.getAttributes();
                a = (String) h.get(Tag.TAGNAME);
                href = (String) h.get("HREF");
                myValue = (String) h.get("MYPARAMETER");
                nice = (String) h.get("YOURPARAMETER");
                assertEquals("The tagname should be G", a, "G");
                assertEquals(
                    "Check the http address",
                    href,
                    "http://www.iki.fi/kaila");
                assertEquals("myValue is empty", myValue, "");
                assertEquals("The second parameter value", nice, "Kaila");
            }
            if (en.hasMoreNodes())
            {
                node = en.nextNode();
                snode = (StringNode) node;
                assertEquals(
                    "The text of the element",
                    snode.getText(),
                    "Kaarle's homepage");
            }

            if (en.hasMoreNodes())
            {
                node = en.nextNode();
                etag = (EndTag) node;
                assertEquals("Endtag is G", etag.getText(), "G");
            }
            // testing rest
            if (en.hasMoreNodes())
            {
                node = en.nextNode();

                tag = (Tag) node;
                assertEquals("Follow up by p-tag", tag.getText(), "p");
            }
            if (en.hasMoreNodes())
            {
                node = en.nextNode();
                snode = (StringNode) node;
                assertEquals(
                    "Verify the paragraph text",
                    snode.getText(),
                    "Paragraph");
            }
            if (en.hasMoreNodes())
            {
                node = en.nextNode();
View Full Code Here

Examples of org.htmlparser.StringNode

     */
    public void testParseParameterSpace() throws ParserException
    {
        Tag tag;
        EndTag etag;
        StringNode snode;
        Node node = null;
        String lin1 = "<A yourParameter = \"Kaarle\">Kaarle's homepage</A>";
        createParser(lin1);
        NodeIterator en = parser.elements();
        Hashtable h;
        boolean testEnd = true; // test end of first part
        String a, href, myPara, myValue, nice;

        try
        {

            if (en.hasMoreNodes())
            {
                node = en.nextNode();

                tag = (Tag) node;
                h = tag.getAttributes();
                a = (String) h.get(Tag.TAGNAME);
                nice = (String) h.get("YOURPARAMETER");
                assertEquals("Link tag (A)", a, "A");
                assertEquals("yourParameter value", "Kaarle", nice);
            }
            if (!(node instanceof LinkTag))
            {
                // linkscanner has eaten up this piece
                if (en.hasMoreNodes())
                {
                    node = en.nextNode();
                    snode = (StringNode) node;
                    assertEquals(
                        "Value of element",
                        snode.getText(),
                        "Kaarle's homepage");
                }

                if (en.hasMoreNodes())
                {
View Full Code Here

Examples of org.htmlparser.StringNode

     */
    public void testWithoutParseParameter() throws ParserException
    {
        Tag tag;
        EndTag etag;
        StringNode snode;
        Node node = null;
        String testHTML =
            "<A href=\"http://www.iki.fi/kaila\" myParameter yourParameter=\"Kaarle\">Kaarle's homepage</A><p>Paragraph</p>";
        createParser(testHTML);
        NodeIterator en = parser.elements();
View Full Code Here

Examples of org.htmlparser.StringNode

    */
    public void testEmptyTagParseParameter() throws ParserException
    {
        Tag tag;
        EndTag etag;
        StringNode snode;
        Node node = null;
        String testHTML =
            "<INPUT name=\"foo\" value=\"foobar\" type=\"text\" />";

        createParser(testHTML);
View Full Code Here

Examples of org.htmlparser.StringNode

        parser.registerScanners();
        parseAndAssertNodeCount(5);
        assertTrue(
            "Third node should be a string node",
            node[2] instanceof StringNode);
        StringNode stringNode = (StringNode) node[2];
        assertEquals(
            "Third node has incorrect text",
            "<>text",
            stringNode.getText());
    }
View Full Code Here

Examples of org.htmlparser.StringNode

        parser.registerScanners();
        parseAndAssertNodeCount(5);
        assertTrue(
            "Third node should be a string node",
            node[2] instanceof StringNode);
        StringNode stringNode = (StringNode) node[2];
        assertEquals(
            "Third node has incorrect text",
            "text<>",
            stringNode.getText());
    }
View Full Code Here

Examples of org.htmlparser.StringNode

        parser.registerScanners();
        parseAndAssertNodeCount(5);
        assertTrue(
            "Third node should be a string node",
            node[2] instanceof StringNode);
        StringNode stringNode = (StringNode) node[2];
        assertEquals(
            "Third node has incorrect text",
            "text<>text",
            stringNode.getText());
    }
View Full Code Here

Examples of org.htmlparser.StringNode

        Parser.setLineSeparator("\r\n"); // actually a static method
        parseAndAssertNodeCount(5);
        assertTrue(
            "Third node should be a string node",
            node[2] instanceof StringNode);
        StringNode stringNode = (StringNode) node[2];
        String actual = stringNode.getText();
        assertEquals("Third node has incorrect text", "text\r\n<>text", actual);
    }
View Full Code Here

Examples of org.htmlparser.StringNode

        Parser.setLineSeparator("\r\n"); // actually a static method
        parseAndAssertNodeCount(5);
        assertTrue(
            "Third node should be a string node",
            node[2] instanceof StringNode);
        StringNode stringNode = (StringNode) node[2];
        String actual = stringNode.getText();
        assertEquals("Third node has incorrect text", "text<\r\n>text", actual);
    }
View Full Code Here

Examples of org.htmlparser.StringNode

        Parser.setLineSeparator("\r\n"); // actually a static method
        parseAndAssertNodeCount(5);
        assertTrue(
            "Third node should be a string node",
            node[2] instanceof StringNode);
        StringNode stringNode = (StringNode) node[2];
        String actual = stringNode.getText();
        assertEquals("Third node has incorrect text", "text<>\r\ntext", actual);
    }
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.