Package org.htmlparser.util

Examples of org.htmlparser.util.NodeIterator.nextNode()


        String a,href,myValue,nice;

        try {

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

                tag = (Tag)node;
                a = ((Attribute)(tag.getAttributesEx ().elementAt (0))).getName ();
                href = tag.getAttribute ("HREF");
                myValue = tag.getAttribute ("MYPARAMETER");
View Full Code Here


                assertEquals ("Check the http address",href,"http://www.iki.fi/kaila");
                assertEquals ("myValue is not null",myValue,null);
                assertEquals ("The second parameter value",nice,"Kaila");
            }
            if (en.hasMoreNodes()) {
                node = en.nextNode();
                snode = (Text)node;
                assertEquals("The text of the element",snode.getText(),"Kaarle's homepage");
            }

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

                snode = (Text)node;
                assertEquals("The text of the element",snode.getText(),"Kaarle's homepage");
            }

            if (en.hasMoreNodes()) {
                node = en.nextNode();
                etag = (Tag)node;
                assertEquals("Endtag is G","/G", etag.getText());
            }
            // testing rest
            if (en.hasMoreNodes()) {
View Full Code Here

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

                tag = (Tag)node;
                assertEquals("Follow up by p-tag","p", tag.getText());
            }
            if (en.hasMoreNodes()) {
View Full Code Here

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

                node = en.nextNode();
                snode = (Text)node;
                assertEquals("Verify the paragraph text","Paragraph", snode.getText());
            }
            if (en.hasMoreNodes()) {
                node = en.nextNode();
                etag = (Tag)node;
                assertEquals("Still patragraph endtag","/p", etag.getText());
            }

        } catch (ClassCastException ce) {
View Full Code Here

        String a,nice;

        try {

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

                tag = (Tag)node;
                a = ((Attribute)(tag.getAttributesEx ().elementAt (0))).getName ();
                nice = tag.getAttribute ("YOURPARAMETER");
                assertEquals ("Link tag (A)",a,"A");
View Full Code Here

                assertEquals ("yourParameter value","Kaarle",nice);
            }
            if (!(node instanceof LinkTag)) {
                // linkscanner has eaten up this piece
                if ( en.hasMoreNodes()) {
                    node = en.nextNode();
                    snode = (Text)node;
                    assertEquals("Value of element","Kaarle's homepage",snode.getText());
                }

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

                    snode = (Text)node;
                    assertEquals("Value of element","Kaarle's homepage",snode.getText());
                }

                if (en.hasMoreNodes()) {
                    node = en.nextNode();
                    etag = (Tag)node;
                    assertEquals("Still patragraph endtag","/A",etag.getText());
                }
            }
            // testing rest
View Full Code Here

        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();
        String result="";
        while (en.hasMoreNodes()) {
            node = en.nextNode();
            result += node.toHtml();
        }
        assertStringEquals("Check collected contents to original", testHTML, result);
    }
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.