Examples of MarkupWriter


Examples of org.apache.tapestry5.MarkupWriter

    }

    @Test
    public void namespaced_elements_and_attributes()
    {
        MarkupWriter w = new MarkupWriterImpl(new XMLMarkupModel());

        Element root = w.elementNS("fredns", "root");

        assertSame(root.defineNamespace("fredns", "fred"), root);

        root.defineNamespace("barneyns", "barney");

        assertSame(w.attributeNS("fredns", "foo", "bar"), root);

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

        assertSame(child.getContainer(), 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

Examples of org.apache.tapestry5.MarkupWriter

    }

    @Test
    public void cdata_content()
    {
        MarkupWriter w = new MarkupWriterImpl(new XMLMarkupModel());

        w.element("root");
        w.write("Normal Text ");
        w.cdata("< & >");
        w.write("More Normal Text");

        assertEquals(w.toString(),
                "<?xml version=\"1.0\"?>\n<root>Normal Text <![CDATA[< & >]]>More Normal Text</root>");
    }
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.