Package org.htmlparser

Examples of org.htmlparser.Node.toHtml()


        assertStringEquals ("new remark html wrong", newremark, rem.toHtml ());
        assertStringEquals ("new remark contents wrong", newtext, rem.getText ());
        assertTrue ("toString wrong", rem.toString ().endsWith (newtext));
        rem.setText (newremark);
        assertStringEquals ("html wrong", newhtml, node[0].toHtml ());
        assertStringEquals ("new remark html wrong", newremark, rem.toHtml ());
        assertStringEquals ("new remark contents wrong", newtext, rem.getText ());
        assertTrue ("toString wrong", rem.toString ().endsWith (newtext));
    }

    public void testFixSpaces () throws ParserException
View Full Code Here


        if (node instanceof TagNode)
            setText (toHtml ((TagNode)node));
        else if (node instanceof TextNode)
            setText (toText ((TextNode)node));
        else
            setText (node.toHtml ());

        return (this);
    }

}
View Full Code Here

            // an orphan end tag
            modifiedResult.append(tag.toHtml());
        else
            if (null == parent.getParent ())
                // a top level tag with no parents
                modifiedResult.append(parent.toHtml());
    }

    public String getModifiedResult() {
        return modifiedResult.toString();
    }
View Full Code Here

        assertEquals("custom tag starting loc",0,customTag.getStartPosition ());
        assertEquals("custom tag ending loc",24,customTag.getEndTag ().getEndPosition ());

        Node child = customTag.childAt(0);
        assertType("child",Tag.class,child);
        assertStringEquals("child html",childtag,child.toHtml());
    }

    public void testCompositeTagWithAnotherTagChild() throws ParserException {
        String childtag = "<Another/>";
        createParser(
View Full Code Here

        AnotherTag tag = (AnotherTag)child;
        assertEquals("another tag start pos",8,tag.getStartPosition ());
        assertEquals("another tag ending pos",18,tag.getEndPosition ());

        assertEquals("custom end tag start pos",18,customTag.getEndTag().getStartPosition ());
        assertStringEquals("child html",childtag,child.toHtml());
    }

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

        createParser (teststring);
        for (NodeIterator i = parser.elements (); i.hasMoreNodes ();)
        {
            Node tnode = i.nextNode ();
            htmlBuffer.append (tnode.toHtml ());
        }
        assertStringEquals ("bad html", teststring, htmlBuffer.toString ());
    }

    /**
 
View Full Code Here

        for (SimpleNodeIterator e = children (); e.hasMoreNodes ();)
        {
            node = e.nextNode ();
            // eliminate virtual tags
            if (!verbatim || !(node.getStartPosition () == node.getEndPosition ()))
                sb.append (node.toHtml ());
        }
    }

    /**
     * Add the textual contents of the end tag of this node to the buffer.
View Full Code Here

                    System.out.println ();
                }
            }
            else
                attributes = null;
            String string = node.toHtml ();
            assertEquals ("toHtml differs", html, string);
            assertTrue ("shouldn't be any more nodes", !iterator.hasMoreNodes ());
        }
        catch (ParserException pe)
        {
View Full Code Here

            for (SimpleNodeIterator e = children (); e.hasMoreNodes ();)
            {
                node = e.nextNode ();
                // eliminate virtual tags
                if (!verbatim || !(node.getStartPosition () == node.getEndPosition ()))
                    sb.append (node.toHtml (verbatim));
            }
    }

    /**
     * Print the contents of the script tag suitable for debugging display.
View Full Code Here

        Node node;

        reference = "<head>";
        lexer = new Lexer (reference);
        node = lexer.nextNode ();
        assertEquals ("Tag contents wrong", reference, node.toHtml ());

        reference = "<head>";
        suffix = "<body>";
        lexer = new Lexer (reference + suffix);
        node = lexer.nextNode ();
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.