Package org.htmlparser

Examples of org.htmlparser.Node


        Parser parser;
        String url =
            "http://htmlparser.sourceforge.net/test/This is a Test Page.html";

        parser = new Parser(url);
        Node node[] = new Node[30];
        int i = 0;
        for (NodeIterator e = parser.elements(); e.hasMoreNodes();)
        {
            node[i] = e.nextNode();
            i++;
View Full Code Here


        int i = 0;
        NodeList collectionList = new NodeList();

        for (NodeIterator e = parser.elements(); e.hasMoreNodes();)
        {
            Node node = e.nextNode();
            node.collectInto(collectionList, LinkTag.class);
        }
        assertEquals(
            "Size of collection vector should be 11",
            11,
            collectionList.size());
        // All items in collection vector should be links
        for (SimpleNodeIterator e = collectionList.elements();
            e.hasMoreNodes();
            )
        {
            Node node = e.nextNode();
            assertTrue(
                "Only links should have been parsed",
                node instanceof LinkTag);
        }
    }
View Full Code Here

        int i = 0;
        NodeList collectionList = new NodeList();

        for (NodeIterator e = parser.elements(); e.hasMoreNodes();)
        {
            Node node = e.nextNode();
            node.collectInto(collectionList, ImageTag.IMAGE_TAG_FILTER);
        }
        assertEquals(
            "Size of collection vector should be 5",
            5,
            collectionList.size());
        // All items in collection vector should be links
        for (SimpleNodeIterator e = collectionList.elements();
            e.hasMoreNodes();
            )
        {
            Node node = e.nextNode();
            assertTrue(
                "Only images should have been parsed",
                node instanceof ImageTag);
        }
    }
View Full Code Here

                + "</tr>\n"
                + "</table>\n"
                + "</body></html>\n");
        for (NodeIterator e = parser.elements(); e.hasMoreNodes();)
        {
            Node node = e.nextNode();
        }
    }
View Full Code Here

     * Rip all mail addresses from the given url, and return an enumeration of such mail addresses.
     * @return Enumeration of mail addresses (a vector of LinkTag)
     */
    public Enumeration rip() throws ParserException
    {
        Node node;
        Vector mailAddresses = new Vector();
        for (NodeIterator e = parser.elements(); e.hasMoreNodes();)
        {
            node = e.nextNode();
            if (node instanceof LinkTag)
View Full Code Here

                + "</table>\n"
                + "</body></html>");
        int i = 0;
        for (NodeIterator e = parser.elements(); e.hasMoreNodes();)
        {
            Node node = e.nextNode();
            if (7 == i)
            {
                assertTrue("not a tag", node instanceof Tag);
                assertTrue(
                    "ALT attribute incorrect",
View Full Code Here

    public void setUp() throws Exception
    {
        Parser parser = Parser.createParser(FormScannerTest.FORM_HTML);
        parser.registerScanners();
        NodeIterator e = parser.elements();
        Node node = e.nextNode();
        formTag = (FormTag) node;
        formChildren = new Vector();
        for (SimpleNodeIterator se = formTag.children(); se.hasMoreNodes();)
        {
            formChildren.addElement(se.nextNode());
View Full Code Here

        long start = System.currentTimeMillis();
        for (long i = 0; i < numTimes; i++)
        {
            for (Enumeration e = formChildren.elements(); e.hasMoreElements();)
            {
                Node node = (Node) e.nextElement();
            }
        }
        long end = System.currentTimeMillis();
        time[index] = end - start;
    }
View Full Code Here

        long start = System.currentTimeMillis();
        for (long i = 0; i < numTimes; i++)
        {
            for (SimpleNodeIterator e = formTag.children(); e.hasMoreNodes();)
            {
                Node node = e.nextNode();
            }
        }
        long end = System.currentTimeMillis();
        time[index] = end - start;
    }
View Full Code Here

        public void run()
        {
            try
            {
                result = false;
                Node linkTag[] = parser.extractAllNodesThatAre(LinkTag.class);
                link1 = (LinkTag) linkTag[0];
                link2 = (LinkTag) linkTag[1];
                if (id < max / 2)
                {
                    if (link1
View Full Code Here

TOP

Related Classes of org.htmlparser.Node

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.