Package org.htmlparser.util

Examples of org.htmlparser.util.NodeList


    public ObjectFindingVisitor(Class classTypeToFind, boolean recurse)
    {
        super(recurse);
        this.classTypeToFind = classTypeToFind;
        this.tags = new NodeList();
    }
View Full Code Here


        parser.registerScanners();
        parser.addScanner(new DivScanner());
        parser.addScanner(new SpanScanner());
        parseAndAssertNodeCount(1);
        Div div = (Div) node[0];
        NodeList nodeList = new NodeList();
        div.collectInto(nodeList, Span.class);
        Node[] spans = nodeList.toNodeArray();
        assertSpanContent(spans);
    }
View Full Code Here

        parser.addScanner(new DivScanner());
        parser.addScanner(new SpanScanner());
        parser.addScanner(new TableScanner(parser));
        parseAndAssertNodeCount(1);
        TableTag tableTag = (TableTag) node[0];
        NodeList nodeList = new NodeList();
        tableTag.collectInto(nodeList, Span.class);
        Node[] spans = nodeList.toNodeArray();
        assertSpanContent(spans);
    }
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];
        NodeList nodeList = formTag.searchFor("USER NAME");
        assertEquals("Should have found nodes", 1, nodeList.size());

        Node[] nodes = nodeList.toNodeArray();

        assertEquals("Number of nodes found", 1, nodes.length);
        assertType("search result node", StringNode.class, nodes[0]);
        StringNode stringNode = (StringNode) nodes[0];
        assertEquals(
View Full Code Here

        parser.registerScanners();
        parseAndAssertNodeCount(1);
        assertTrue("Node 0 should be Form Tag", node[0] instanceof FormTag);
        FormTag formTag = (FormTag) node[0];
        NodeList nodeList = formTag.searchFor("USER NAME", true);
        assertEquals("Should have not found nodes", 0, nodeList.size());

        nodeList = formTag.searchFor("User Name", true);
        assertNotNull("Should have not found nodes", nodeList);
    }
View Full Code Here

        parser.addScanner(new TableColumnScanner());
    }

    public Tag createTag(TagData tagData, CompositeTagData compositeTagData)
    {
        NodeList columns =
            compositeTagData.getChildren().searchFor(TableColumn.class);
        return new TableRow(tagData, compositeTagData, columns);
    }
View Full Code Here

    }

    public Tag createTag(TagData tagData, CompositeTagData compositeTagData)
    {
        NodeList rows =
            compositeTagData.getChildren().searchFor(TableRow.class);
        return new TableTag(tagData, compositeTagData, rows);
    }
View Full Code Here

                + "if (!hp.isHomePage('http://www.google.com/')) {document.write(\"<p><a href=\"/mgyhp.html\" onClick=\"style.behavior='url(#default#homepage)';setHomePage('http://www.google.com/');\">Make Google Your Homepage!</a>\");}\n"
                + "</script></font>\n"
                + "<p><font size=-2>&copy;2002 Google</font><font size=-2> - Searching 3,083,324,652 web pages</font></center></body></html>\n");
        parser.registerScanners();
        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(
View Full Code Here

    public CompositeTagData(Tag startTag, Tag endTag, NodeList children)
    {
        this.startTag = startTag;
        this.endTag = endTag;
        this.children = new NodeList();
        if (children != null)
            for (SimpleNodeIterator i = children.elements(); i.hasMoreNodes();)
            {
                this.children.add(i.nextNode());
            }
View Full Code Here

                + "</tr></table></div>\n"
                + "</body>\n"
                + "</html>");
        parser.registerScanners();
        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(
View Full Code Here

TOP

Related Classes of org.htmlparser.util.NodeList

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.