Package org.htmlparser

Examples of org.htmlparser.Node.toHtml()


        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",
View Full Code Here


        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",
View Full Code Here

        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>",
View Full Code Here

    assertEquals("custom tag ending loc",23,customTag.elementEnd());

    Node child = customTag.childAt(0);
    assertType("child",Tag.class,child);
    Tag tag = (Tag)child;
    assertStringEquals("child html","<HELLO>",child.toHtml());
  }

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

    AnotherTag tag = (AnotherTag)child;
    assertEquals("another tag start pos",8,tag.elementBegin());
    assertEquals("another tag ending pos",17,tag.elementEnd());
   
    assertEquals("custom end tag start pos",18,customTag.getEndTag().elementBegin());
    assertStringEquals("child html","<ANOTHER/>",child.toHtml());
  }
   
  public void testParseTwoCompositeTags() throws ParserException {
    createParser(
      "<Custom>" +
View Full Code Here

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

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

                {
                    // Its a new line
                    sb.append(lineSeparator);
                }
            }
            sb.append(node.toHtml());
            prevNode = node;
        }
        if (prevNode.elementEnd() > endTag.elementBegin())
        {
            sb.append(lineSeparator);
View Full Code Here

    {
        StringBuffer buff = new StringBuffer();
        for (SimpleNodeIterator e = children(); e.hasMoreNodes();)
        {
            Node node = (Node) e.nextNode();
            buff.append(node.toHtml());
        }
        return buff.toString();
    }

    public void accept(NodeVisitor visitor)
View Full Code Here

                        tags.addAll(tagsForPreviousTemplate);
                    }
                } else {
                    final Snippet snippet = tags.size() == 0 ? null : tags.peek();
                    if (snippet instanceof HtmlSnippet) {
                        ((HtmlSnippet) snippet).append(node.toHtml());
                    } else {
                        final HtmlSnippet htmlSnippet = new HtmlSnippet(lineNumbers, filePath);
                        htmlSnippet.append(node.toHtml());
                        tags.push(htmlSnippet);
                    }
View Full Code Here

                    final Snippet snippet = tags.size() == 0 ? null : tags.peek();
                    if (snippet instanceof HtmlSnippet) {
                        ((HtmlSnippet) snippet).append(node.toHtml());
                    } else {
                        final HtmlSnippet htmlSnippet = new HtmlSnippet(lineNumbers, filePath);
                        htmlSnippet.append(node.toHtml());
                        tags.push(htmlSnippet);
                    }
                }

            }
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.