Package org.htmlparser

Examples of org.htmlparser.Node.toPlainTextString()


    assertEquals("ending line position", 1, customTag.tagData.getEndLine());

    Node child = customTag.childAt(0);
    assertType("child", StringNode.class, child);
    StringNode text = (StringNode) child;
    assertStringEquals("child text", "Hello", child.toPlainTextString());
  }

  public void testCompositeTagWithTagChild() throws ParserException {
    createParser("<Custom>" + "<Hello>" + "</Custom>");
    CustomTag customTag = parseCustomTag(1);
View Full Code Here


    Node node;
    if (!caseSensitive)
      searchString = searchString.toUpperCase();
    for (SimpleNodeIterator e = children(); e.hasMoreNodes();) {
      node = e.nextNode();
      String nodeTextString = node.toPlainTextString();
      if (!caseSensitive)
        nodeTextString = nodeTextString.toUpperCase();
      if (nodeTextString.indexOf(searchString) != -1) {
        foundList.add(node);
      }
View Full Code Here

  public int findPositionOf(String text) {
    Node node;
    int loc = 0;
    for (SimpleNodeIterator e = children(); e.hasMoreNodes();) {
      node = e.nextNode();
      if (node.toPlainTextString().toUpperCase().indexOf(text.toUpperCase()) != -1) {
        return loc;
      }
      loc++;
    }
    return -1;
View Full Code Here

    Node nextNode;
    String text = null;
    do {
      nextNode = nodeIterator.nextNode();
      if (nextNode instanceof StringNode) {
        text = nextNode.toPlainTextString().trim();
      } else
        text = null;
    } while (text != null && text.length() == 0);
    return nextNode;
  }
View Full Code Here

    assertEquals("bullets in first list", 2, nestedBulletLists.size());
    BulletList firstList = (BulletList) nestedBulletLists.elementAt(0);
    Bullet firstBullet = (Bullet) firstList.childAt(0);
    Node firstNodeInFirstBullet = firstBullet.childAt(0);
    assertType("first child in bullet", StringNode.class, firstNodeInFirstBullet);
    assertStringEquals("expected text", "Energy supply\r\n" + " (Campbell)  ", firstNodeInFirstBullet
        .toPlainTextString());
  }
}
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.