Package org.apache.tapestry5

Examples of org.apache.tapestry5.MarkupWriter.end()


    {
        MarkupWriter w = new MarkupWriterImpl();

        w.element("root");
        w.comment("<&>");
        w.end();

        assertEquals(w.toString(), "<root><!-- <&> --></root>");
    }

    @Test
View Full Code Here


        w.element("root");
        w.write("before");
        w.comment("A comment");
        w.write("after");
        w.end();

        assertEquals(w.toString(), "<root>before<!-- A comment -->after</root>");
    }

    @Test
View Full Code Here

    {
        MarkupWriter w = new MarkupWriterImpl();

        w.element("root");
        w.write(null);
        w.end();

        assertEquals(w.toString(), "<root></root>");
    }

    @Test
View Full Code Here

        w.element("root");
        w.write("<");
        w.writeRaw("&nbsp;");
        w.write(">");
        w.end();

        assertEquals(w.toString(), "<root>&lt;&nbsp;&gt;</root>");
    }

    @Test
View Full Code Here

        Element child = w.elementNS("barneyns", "child");

        assertSame(child.getParent(), root);

        w.end(); // child
        w.end(); // root

        assertEquals(w.toString(),
                     "<?xml version=\"1.0\"?>\n<fred:root fred:foo=\"bar\" xmlns:barney=\"barneyns\" xmlns:fred=\"fredns\"><barney:child/></fred:root>");
    }
View Full Code Here

        Element child = w.elementNS("barneyns", "child");

        assertSame(child.getParent(), root);

        w.end(); // child
        w.end(); // root

        assertEquals(w.toString(),
                     "<?xml version=\"1.0\"?>\n<fred:root fred:foo=\"bar\" xmlns:barney=\"barneyns\" xmlns:fred=\"fredns\"><barney:child/></fred:root>");
    }
View Full Code Here

        w.element("listener");
        w.write("before n-w-l");
        w.element("nested-with-listener");
        w.write("n-w-l text");
        w.end();
        w.write("after n-w-l");
        w.end();

        w.removeListener(l);
View Full Code Here

        w.write("before n-w-l");
        w.element("nested-with-listener");
        w.write("n-w-l text");
        w.end();
        w.write("after n-w-l");
        w.end();

        w.removeListener(l);

        w.write("after listener");
View Full Code Here

        w.removeListener(l);

        w.write("after listener");

        w.end();
        w.end();

        // Because we are invoking Element.text(), the text added by the listener is appended to the body of the element,
        // which is correct but may not be what you'd expect.
View Full Code Here

        w.removeListener(l);

        w.write("after listener");

        w.end();
        w.end();

        // Because we are invoking Element.text(), the text added by the listener is appended to the body of the element,
        // which is correct but may not be what you'd expect.

        assertEquals(w.toString(), "<?xml version=\"1.0\"?>\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.