Package org.htmlparser.tags

Examples of org.htmlparser.tags.TableTag


                + "  <td>cell 1</td>"
                + "  <td>cell 2</td>"
                + "</tr>"
                + "</table>",
            bodyNodes.asHtml());
        TableTag tables[] = page.getTables();
        assertEquals("number of tables", 1, tables.length);
        assertEquals("number of rows", 1, tables[0].getRowCount());
        TableRow row = tables[0].getRow(0);
        assertEquals("number of columns", 2, row.getColumnCount());
        TableColumn[] col = row.getColumns();
View Full Code Here


        parser.registerScanners();
        parser.addScanner(new TableScanner(parser));
        parser.addScanner(new DivScanner());
        parseAndAssertNodeCount(1);
        assertType("node should be table", TableTag.class, node[0]);
        TableTag tableTag = (TableTag) node[0];
        Div div = (Div) tableTag.searchFor(Div.class).toNodeArray()[0];
        assertEquals("div contents", "some text", div.toPlainTextString());
    }
View Full Code Here

        parser.registerScanners();
        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

    {
        createParser(createHtmlWithTable());
        parser.addScanner(new TableScanner(parser));
        parseAndAssertNodeCount(1);
        assertTrue(node[0] instanceof TableTag);
        TableTag tableTag = (TableTag) node[0];
        assertEquals("rows", 1, tableTag.getRowCount());
        TableRow row = tableTag.getRow(0);
        assertEquals("columns in row 1", 2, row.getColumnCount());
        assertEquals("table width", "100.0%", tableTag.getAttribute("WIDTH"));
    }
View Full Code Here

                + "</BODY>\n"
                + "</HTML>");
        parser.registerScanners();
        parseAndAssertNodeCount(4);
        assertType("second tag", TableTag.class, node[1]);
        TableTag table = (TableTag) node[1];
        assertEquals("rows", 3, table.getRowCount());
        TableRow tr = table.getRow(2);
        assertEquals("columns", 1, tr.getColumnCount());
        TableColumn td = tr.getColumns()[0];
        Node node = td.childAt(0);
        assertType("node", TableTag.class, node);
        TableTag table2 = (TableTag) node;
        assertEquals("second table row count", 1, table2.getRowCount());
        tr = table2.getRow(0);
        assertEquals("second table col count", 2, tr.getColumnCount());
    }
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

    TableRow tableRow = new TableRow();
    tableRow.setChildren(rowColumns);
    NodeList rows = new NodeList();
    rows.add(tableHeader);
    rows.add(tableRow);
    TableTag tableTag = new TableTag();
    tableTag.setChildren(rows);
      List<Assertion> list = new QueryTable(new HtmlTable(tableTag), "id", new SlimTestContextImpl()).getAssertions();
      return list.get(0);
    }
View Full Code Here

        registerTag (new SelectTag ());
        registerTag (new StyleTag ());
        registerTag (new TableColumn ());
        registerTag (new TableHeader ());
        registerTag (new TableRow ());
        registerTag (new TableTag ());
        registerTag (new TextareaTag ());
        registerTag (new TitleTag ());
        registerTag (new Div ());
        registerTag (new Span ());
        registerTag (new BodyTag ());
View Full Code Here

                    "</tr>" +
                "</table>" +
            "</table>"
        );
        parseAndAssertNodeCount(1);
        TableTag tableTag = (TableTag)node[0];
        Text[] stringNode =
            tableTag.digupStringNode("Hello World");

        assertEquals("number of string nodes",1,stringNode.length);
        assertNotNull("should have found string node",stringNode);
        Node parent = stringNode[0].getParent();
        assertType("should be column",TableColumn.class,parent);
View Full Code Here

                    "</tr>" +
                "</table>" +
            "</table>"
        );
        parseAndAssertNodeCount(1);
        TableTag tableTag = (TableTag)node[0];
        Text [] stringNode =
            tableTag.digupStringNode("Hello World");

        assertEquals("number of string nodes",1,stringNode.length);
        assertNotNull("should have found string node",stringNode);
        CompositeTag parent = (CompositeTag)stringNode[0].getParent();
        int pos = parent.findPositionOf(stringNode[0]);
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.TableTag

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.