Examples of enablePrettyPrint()


Examples of org.apache.commons.betwixt.io.BeanWriter.enablePrettyPrint()

//        log = new SimpleLog("[TextElementsIO:AbstractBeanWriter]");
//        log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
//        result.setAbstractBeanWriterLog(log);
       
        result.setXMLIntrospector(newXMLIntrospector(mapper));
        result.enablePrettyPrint();
        result.setWriteIDs(false);
        return result;
    }

    private XMLIntrospector newXMLIntrospector(NameMapper mapper) {
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanWriter.enablePrettyPrint()

        // Configure betwixt
        // For more details see java docs or later in the main documentation
        beanWriter.getXMLIntrospector().setAttributesForPrimitives(true);
        beanWriter.setWriteIDs(false);
        beanWriter.enablePrettyPrint();

        // Write example bean as base element 'person'
        beanWriter.write("message", msg);
        beanWriter.flush();
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanWriter.enablePrettyPrint()

//        log = new SimpleLog("[TestElementsAlt:AbstractBeanWriter]");
//        log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
//        result.setAbstractBeanWriterLog(log);
       
        result.setXMLIntrospector(newXMLIntrospector(mapper));
        result.enablePrettyPrint();
        result.setWriteIDs(false);
        return result;
    }

    private XMLIntrospector newXMLIntrospector(NameMapper mapper) {
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanWriter.enablePrettyPrint()

    }
       
    public void write(Object bean) throws Exception {
        BeanWriter writer = new BeanWriter();
        writer.getXMLIntrospector().setAttributesForPrimitives(false);
        writer.enablePrettyPrint();
        writer.write( bean );
    }
}
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanWriter.enablePrettyPrint()

       
        System.out.println( "Now trying pretty print" );
       
        BeanWriter writer = new BeanWriter();
        writer.setWriteEmptyElements(true);
        writer.enablePrettyPrint();
        writer.write( bean );
    }
   
   
    public void testLooping() throws Exception {
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanWriter.enablePrettyPrint()

//        writer.setAbstractBeanWriterLog(log);
       
//        log = new SimpleLog("[testLooping]");
//        log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
       
        writer.enablePrettyPrint();
        writer.write( LoopBean.createNoLoopExampleBean() );   
       
        String xml ="<?xml version='1.0'?><LoopBean><name>Root</name><friend><name>level1</name>"
                + "<friend><name>level2</name><friend><name>level3</name><friend><name>level4</name>"
                + "<friend><name>level5</name></friend></friend></friend></friend></friend></LoopBean>";
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanWriter.enablePrettyPrint()

    public void testEscaping() throws Exception {
        //XXX find a way to automatically verify test
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        BeanWriter writer = new BeanWriter(out);
        writer.setWriteEmptyElements( true );
        writer.enablePrettyPrint();
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.setAttributesForPrimitives(true);
        writer.setXMLIntrospector(introspector);
        writer.write(new LoopBean("Escape<LessThan"));
        writer.write(new LoopBean("Escape>GreaterThan"));
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanWriter.enablePrettyPrint()

        StringWriter out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        BeanWriter beanWriter = new BeanWriter(out);
        beanWriter.setXMLIntrospector(createXMLIntrospector());
        beanWriter.setWriteIDs(false);
        beanWriter.enablePrettyPrint();
       
        beanWriter.write(po);
        String xml = "<?xml version='1.0'?><content><printingno>555008805581</printingno>"
                + "<componenttest><compdescription>Text</compdescription></componenttest>"
                + "<componenttest><compdescription>Binding</compdescription></componenttest>"
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanWriter.enablePrettyPrint()

    protected void write(Object bean, Writer out)
        throws Exception
    {
        BeanWriter writer = new BeanWriter(out);
        writer.setXMLIntrospector(createXMLIntrospector());
        writer.enablePrettyPrint();
        writer.write(bean);
    }
}
View Full Code Here

Examples of org.apache.commons.betwixt.io.BeanWriter.enablePrettyPrint()

        //log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
        //writer.setAbstractBeanWriterLog(log);
        writer.setWriteEmptyElements(true);
        writer.getXMLIntrospector().setAttributesForPrimitives(false);
        writer.setWriteIDs(false);
        writer.enablePrettyPrint();
        writer.write( bean );
    }
}
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.