Examples of toNodeArray()


Examples of org.htmlparser.util.NodeList.toNodeArray()

        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);
    }

    public void testTwoLevelNesting() throws ParserException
    {
View Full Code Here

Examples of org.htmlparser.util.NodeList.toNodeArray()

        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

Examples of org.htmlparser.util.NodeList.toNodeArray()

        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

Examples of org.htmlparser.util.NodeList.toNodeArray()

        NodeList nodeList = new NodeList();
        for (NodeIterator e = elements(); e.hasMoreNodes();)
        {
            e.nextNode().collectInto(nodeList, nodeType);
        }
        return nodeList.toNodeArray();
    }

    /**
     * Creates the parser on an input string.
     * @param inputHTML
View Full Code Here

Examples of org.htmlparser.util.NodeList.toNodeArray()

       
        ret = new NodeList ();
        filter = new NodeClassFilter (type);
        node.collectInto (ret, filter);

        return (ret.toNodeArray ());
    }

    /**
     * Split the input string considering as string separator
     * all the not numerical characters
View Full Code Here

Examples of org.htmlparser.util.NodeList.toNodeArray()

        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",Text.class,nodes[0]);
        Text stringNode = (Text)nodes[0];
        assertEquals("Expected contents of string node","User Name",stringNode.getText());
View Full Code Here

Examples of org.htmlparser.util.NodeList.toNodeArray()

    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("Expected contents of string node", "User Name", stringNode.getText());
View Full Code Here

Examples of org.htmlparser.util.NodeList.toNodeArray()

    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);
  }

  public void testTwoLevelNesting() throws ParserException {
    createParser("<table>" + "  <DIV>" + "    <SPAN>The Refactoring Challenge</SPAN>" + "    <SPAN>&#013;id: 6</SPAN>"
View Full Code Here

Examples of org.htmlparser.util.NodeList.toNodeArray()

    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

Examples of org.htmlparser.util.NodeList.toNodeArray()

  public Node[] extractAllNodesThatAre(Class nodeType) throws ParserException {
    NodeList nodeList = new NodeList();
    for (NodeIterator e = elements(); e.hasMoreNodes();) {
      e.nextNode().collectInto(nodeList, nodeType);
    }
    return nodeList.toNodeArray();
  }

  /**
   * Creates the parser on an input string.
   *
 
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.