Package org.htmlparser

Examples of org.htmlparser.StringNode.toPlainTextString()


    AnotherTag anotherTag = (AnotherTag)node;
    assertEquals("another tag children count",1,anotherTag.getChildCount());
    node = anotherTag.childAt(0);
    assertType("nested child",StringNode.class,node);
    StringNode text = (StringNode)node;
    assertEquals("text","Hello",text.toPlainTextString());
  }

  public void testCompositeTagWithTwoNestedTags() throws ParserException {
    createParser(
      "<Custom>" +
View Full Code Here


    AnotherTag anotherTag = (AnotherTag)node;
    assertEquals("another tag children count",1,anotherTag.getChildCount());
    node = anotherTag.childAt(0);
    assertType("nested child",StringNode.class,node);
    StringNode text = (StringNode)node;
    assertEquals("text","Hello",text.toPlainTextString());
  }
 
  public void testErroneousCompositeTag() throws ParserException {
    createParser("<custom>");
    CustomTag customTag = parseCustomTag(1);
View Full Code Here

    assertEquals("starting line position",1,customTag.tagData.getStartLine());
    assertEquals("ending line position",1,customTag.tagData.getEndLine());
    AnotherTag anotherTag = (AnotherTag)customTag.childAt(0);
    assertEquals("anotherTag child count",1,anotherTag.getChildCount());
    StringNode stringNode = (StringNode)anotherTag.childAt(0);
    assertStringEquals("anotherTag child text","something",stringNode.toPlainTextString());
    assertStringEquals(
      "first custom tag html",
      "<CUSTOM><ANOTHER>something</ANOTHER></CUSTOM>",
      customTag.toHtml()
    );   
View Full Code Here

            node[3] instanceof StringNode);
        StringNode stringNode = (StringNode) node[3];
        assertEquals(
            "First String Node",
            "This is the Title",
            stringNode.toPlainTextString());
        assertTrue(
            "Eighth Node identified must be a string node",
            node[7] instanceof StringNode);
        stringNode = (StringNode) node[7];
        assertEquals(
View Full Code Here

            node[7] instanceof StringNode);
        stringNode = (StringNode) node[7];
        assertEquals(
            "Second string node",
            "Hello World, this is the HTML Parser",
            stringNode.toPlainTextString());
    }

    public void testToHTML() throws ParserException
    {
        createParser("<HTML><HEAD><TITLE>This is the Title</TITLE></HEAD><BODY>Hello World, this is the HTML Parser</BODY></HTML>");
View Full Code Here

        assertType("first node", StringNode.class, node[0]);
        StringNode stringNode = (StringNode) node[0];
        assertStringEquals(
            "text",
            "Testing &\r\nRefactoring",
            stringNode.toPlainTextString());
    }

}
View Full Code Here

    AnotherTag anotherTag = (AnotherTag) node;
    assertEquals("another tag children count", 1, anotherTag.getChildCount());
    node = anotherTag.childAt(0);
    assertType("nested child", StringNode.class, node);
    StringNode text = (StringNode) node;
    assertEquals("text", "Hello", text.toPlainTextString());
  }

  public void testCompositeTagWithTwoNestedTags() throws ParserException {
    createParser("<Custom>" + "<Another>" + "Hello" + "</Another>" + "<unknown>" + "World" + "</unknown>"
        + "<Custom/>" + "</Custom>" + "<Custom/>");
View Full Code Here

    AnotherTag anotherTag = (AnotherTag) node;
    assertEquals("another tag children count", 1, anotherTag.getChildCount());
    node = anotherTag.childAt(0);
    assertType("nested child", StringNode.class, node);
    StringNode text = (StringNode) node;
    assertEquals("text", "Hello", text.toPlainTextString());
  }

  public void testErroneousCompositeTag() throws ParserException {
    createParser("<custom>");
    CustomTag customTag = parseCustomTag(1);
View Full Code Here

    assertEquals("starting line position", 1, customTag.tagData.getStartLine());
    assertEquals("ending line position", 1, customTag.tagData.getEndLine());
    AnotherTag anotherTag = (AnotherTag) customTag.childAt(0);
    assertEquals("anotherTag child count", 1, anotherTag.getChildCount());
    StringNode stringNode = (StringNode) anotherTag.childAt(0);
    assertStringEquals("anotherTag child text", "something", stringNode.toPlainTextString());
    assertStringEquals("first custom tag html", "<CUSTOM><ANOTHER>something</ANOTHER></CUSTOM>", customTag.toHtml());
    customTag = (CustomTag) node[1];
    assertStringEquals("second custom tag html", "<CUSTOM><ANOTHER>else</ANOTHER></CUSTOM>", customTag.toHtml());
  }
View Full Code Here

  public void testToPlainTextString() throws ParserException {
    createParser("<HTML><HEAD><TITLE>This is the Title</TITLE></HEAD><BODY>Hello World, this is the HTML Parser</BODY></HTML>");
    parseAndAssertNodeCount(10);
    assertTrue("Fourth Node identified must be a string node", node[3] instanceof StringNode);
    StringNode stringNode = (StringNode) node[3];
    assertEquals("First String Node", "This is the Title", stringNode.toPlainTextString());
    assertTrue("Eighth Node identified must be a string node", node[7] instanceof StringNode);
    stringNode = (StringNode) node[7];
    assertEquals("Second string node", "Hello World, this is the HTML Parser", stringNode.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.