Package org.htmlparser

Examples of org.htmlparser.Node.toHtml()


        iterator = parser.elements ();
        node = iterator.nextNode ();
        if (node == null)
            fail ("too few nodes");
        else
            assertStringEquals ("bad parse", html, node.toHtml());
        assertTrue (node instanceof ScriptTag);
        assertStringEquals ("bad cdata", cdata, ((ScriptTag)node).getScriptCode ());
        assertNull ("too many nodes", iterator.nextNode ());
    }
View Full Code Here


        iterator = parser.elements ();
        node = iterator.nextNode ();
        if (node == null)
            fail ("too few nodes");
        else
            assertStringEquals ("bad parse", html, node.toHtml());
        assertTrue (node instanceof StyleTag);
        assertStringEquals ("bad cdata", cdata, ((StyleTag)node).getStyleCode ());
        assertNull ("too many nodes", iterator.nextNode ());
    }
View Full Code Here

        NodeIterator e = parser.elements();
        Node node = e.nextNode();

        // First node is doctype
        assertStringEquals("Doctype element output is incorrect.", DOCTYPE, node.toHtml());
    }
}
View Full Code Here

        createParser(testHTML);
        NodeIterator en = parser.elements();
        String result="";
        while (en.hasMoreNodes()) {
            node = en.nextNode();
            result += node.toHtml();
        }
        assertStringEquals("Check collected contents to original", testHTML, result);
    }

    /**
 
View Full Code Here

       createParser(testHTML);
       NodeIterator en = parser.elements();
       String result="";
       while (en.hasMoreNodes()) {
           node = en.nextNode();
           result = node.toHtml();
       }
       assertStringEquals("Check collected contents to original", testHTML, result);
    }

View Full Code Here

        createParser (html);
        String temp = null;
        for (NodeIterator e = parser.elements (); e.hasMoreNodes ();)
        {
            Node newNode = e.nextNode ()// Get the next HTML Node
            temp = newNode.toHtml();
        }
        assertNotNull ("No nodes", temp);
        assertStringEquals ("Incorrect HTML output: ", html + "</a>", temp);
    }
View Full Code Here

    NodeIterator en = parser.elements();
    String result = "";
    try {
      while (en.hasMoreNodes()) {
        node = en.nextNode();
        result += node.toHtml();
      }
      String expected = "<A YOURPARAMETER=\"Kaarle\" MYPARAMETER=\"\" HREF=\"http://www.iki.fi/kaila\">Kaarle's homepage</A><P>Paragraph</P>";
      assertStringEquals("Check collected contents to original", expected, result);
    } catch (ClassCastException ce) {
      fail("Bad class element = " + node.getClass().getName());
View Full Code Here

    NodeIterator en = parser.elements();
    String result = "";
    try {
      while (en.hasMoreNodes()) {
        node = en.nextNode();
        result = node.toHtml();
      }
      String expected = "<INPUT VALUE=\"foobar\" NAME=\"foo\" TYPE=\"text\"/>";
      assertStringEquals("Check collected contents to original", expected, result);
    } catch (ClassCastException ce) {
View Full Code Here

    // register standard scanners (Very Important)
    parser.registerScanners();
    String temp = null;
    for (NodeIterator e = parser.elements(); e.hasMoreNodes();) {
      Node newNode = e.nextNode(); // Get the next HTML Node
      temp = newNode.toHtml();
    }
    assertNotNull("No nodes", temp);
    assertEquals("Incorrect HTML output: ", "<A HREF=\"http://www.google.com/webhp?hl=en\"></A>", temp);
  }
View Full Code Here

        + "                    <li>chironomidae</li>" + "                </ul>" + "            </a>"
        + "        </li>" + "    </ul>" + "" + "</body>" + "</html>");
    parser.registerScanners();
    for (NodeIterator i = parser.elements(); i.hasMoreNodes();) {
      Node node = i.nextNode();
      System.out.println(node.toHtml());
    }
  }

  public void testNonEndedBullets() throws ParserException {
    createParser("<li>forest practices legislation penalties for non-compliance\n"
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.