Package org.htmlparser.util

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


        parser = new Parser ("http://www.009.com/");
        try
        {
            iterator = parser.elements ();
            while (iterator.hasMoreNodes ())
                checkTagNames (iterator.nextNode ());
        }
        catch (EncodingChangeException ece)
        {
            parser.reset ();
            iterator = parser.elements ();
View Full Code Here


        catch (EncodingChangeException ece)
        {
            parser.reset ();
            iterator = parser.elements ();
            while (iterator.hasMoreNodes ())
                checkTagNames (iterator.nextNode ());
        }
    }

    /**
     * Check the tag name for one of the ones expected on the page.
View Full Code Here

            "<body>This is <a href=\"foo.html\">the body</a>.</body></html>";
        createParser (html1);
        buffer = new StringBuffer ();
        for (iterator = parser.elements (); iterator.hasMoreNodes (); )
        {
            node = iterator.nextNode ();
            String text = node.toPlainTextString ();
            buffer.append (text);
        }
        assertStringEquals ("conjoined text", expected, buffer.toString ());
View Full Code Here

            "<body>This is <a href=\"foo.html\">the body</a>.</body></html>";
        createParser (html2);
        buffer = new StringBuffer ();
        for (iterator = parser.elements (); iterator.hasMoreNodes (); )
        {
            node = iterator.nextNode ();
            String text = node.toPlainTextString ();
            buffer.append (text);
        }
        assertStringEquals ("conjoined text", expected, buffer.toString ());
       
View Full Code Here

            "<body>\nThis is <a href=\"foo.html\">the body</a>.</body></html>";
        createParser (html3);
        buffer = new StringBuffer ();
        for (iterator = parser.elements (); iterator.hasMoreNodes (); )
        {
            node = iterator.nextNode ();
            String text = node.toPlainTextString ();
            buffer.append (text);
        }
        assertStringEquals ("conjoined text", expected, buffer.toString ());
    }
View Full Code Here

                                                                                                                                                       
        html = "<a href = \"http://test.com\" />";
        createParser (html);
        for (iterator = parser.elements (); iterator.hasMoreNodes (); )
        {
            node = iterator.nextNode ();
            String text = node.toHtml ();
            assertStringEquals ("no overflow", html, text);
        }
        html = "<a href=\"http://test.com\"/>";
        createParser (html);
View Full Code Here

        }
        html = "<a href=\"http://test.com\"/>";
        createParser (html);
        for (iterator = parser.elements (); iterator.hasMoreNodes (); )
        {
            node = iterator.nextNode ();
            String text = node.toHtml ();
            assertStringEquals ("no overflow", html, text);
        }
        html = "<a href = \"http://test.com\"/>";
        createParser (html);
View Full Code Here

        }
        html = "<a href = \"http://test.com\"/>";
        createParser (html);
        for (iterator = parser.elements (); iterator.hasMoreNodes (); )
        {
            node = iterator.nextNode ();
            String text = node.toHtml ();
            assertStringEquals ("no overflow", html, text);
        }
    }
View Full Code Here

        endtag = "</script>";
        html = tag + cdata + endtag;
        parser = new Parser ();
        parser.setInputHTML (html);
        iterator = parser.elements ();
        node = iterator.nextNode ();
        if (node == null)
            fail ("too few nodes");
        else
            assertStringEquals ("bad parse", html, node.toHtml());
        assertTrue (node instanceof ScriptTag);
View Full Code Here

            fail ("too few nodes");
        else
            assertStringEquals ("bad parse", html, node.toHtml());
        assertTrue (node instanceof ScriptTag);
        assertStringEquals ("bad cdata", cdata, ((ScriptTag)node).getScriptCode ());
        assertNull ("too many nodes", iterator.nextNode ());
    }

    /**
     * See bug #1227213 Particular SCRIPT tags close too late.
     * This was actually working prior to the patch, since the
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.