Package com.fasterxml.jackson.dataformat.xml

Examples of com.fasterxml.jackson.dataformat.xml.XmlMapper.writer()


    // Test for ensuring that we can use ".withRootName()" to override
    // default name AND annotation
    public void testRenamedRootItem() throws Exception
    {
        XmlMapper xmlMapper = new XmlMapper();
        String xml = xmlMapper
                .writer()
                .withRootName("Shazam")
                .writeValueAsString(new SampleResource(123, "Foo", "Barfy!"))
                .trim();
        xml = removeSjsxpNamespace(xml);
View Full Code Here


        MyPerson child = new MyPerson();
        child.name = "Junior";
       
        person.children.add(child);

        String xml = _jaxbMapper.writer().writeValueAsString(person);
       
        String expected = "<Individual><name>Jay</name>"
                + "<offspring><kid><name>Junior</name><offspring/></kid></offspring></Individual>";
        assertEquals(expected, xml);
    }
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.