Package org.apache.commons.betwixt.io

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 id='1'><name>Root</name><friend id='2'><name>level1</name>"
                + "<friend id='3'><name>level2</name><friend id='4'><name>level3</name><friend id='5'><name>level4</name>"
                + "<friend id='6'><name>level5</name></friend></friend></friend></friend></friend></LoopBean>";
View Full Code Here


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

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

        //XXX find a way to automatically verify test
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        BeanWriter writer = new BeanWriter(out);
        writer.setWriteEmptyElements( true );
    writer.getBindingConfiguration().setMapIDs(false);
        writer.enablePrettyPrint();
        XMLIntrospector introspector = new XMLIntrospector();
        introspector.getConfiguration().setAttributesForPrimitives(true);
        writer.setXMLIntrospector(introspector);
        writer.write(new LoopBean("Escape<LessThan"));
        writer.write(new LoopBean("Escape>GreaterThan"));
View Full Code Here

        String key = "one";
        map.addValue(key, new Integer(1));
        StringWriter outputWriter = new StringWriter();
        outputWriter.write("<?xml version='1.0' ?>\n");
        BeanWriter beanWriter = new BeanWriter(outputWriter);
        beanWriter.enablePrettyPrint();
        beanWriter.getBindingConfiguration().setMapIDs(true);
        beanWriter.write(map);
        BeanReader beanReader = new BeanReader();
       
        // Configure the reader
View Full Code Here

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

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

                    new FileReader(getTestFile("src/test/org/apache/commons/betwixt/mapping.xml")));
       
        StringWriter outputWriter = new StringWriter();
        outputWriter.write("<?xml version='1.0' ?>\n");
        BeanWriter beanWriter = new BeanWriter(outputWriter);
        beanWriter.enablePrettyPrint();
        beanWriter.setWriteEmptyElements(true);
        beanWriter.getXMLIntrospector().register(source);
        beanWriter.write(partyBean);
        String expectedOut = "<?xml version='1.0' ?>\n" +
                         "  <party id=\"1\">\n" +
View Full Code Here

        StringWriter outputWriter = new StringWriter();

        outputWriter.write("<?xml version='1.0' ?>\n");
        BeanWriter beanWriter = new BeanWriter(outputWriter);
        beanWriter.enablePrettyPrint();
        beanWriter.getBindingConfiguration().setMapIDs(true);
        beanWriter.write(father);

        BeanReader beanReader = new BeanReader();
View Full Code Here

        StringWriter outputWriter = new StringWriter();

        outputWriter.write("<?xml version='1.0' ?>\n");
        BeanWriter beanWriter = new BeanWriter(outputWriter);
        beanWriter.enablePrettyPrint();
        beanWriter.getBindingConfiguration().setMapIDs(true);
        beanWriter.write(person);

        BeanReader beanReader = new BeanReader();
        beanReader.getBindingConfiguration().setMapIDs(true);
View Full Code Here

        StringWriter out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        BeanWriter beanWriter = new BeanWriter(out);
        beanWriter.setXMLIntrospector(createXMLIntrospector());
        beanWriter.getBindingConfiguration().setMapIDs(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

    }
       
    public void write(Object bean) throws Exception {
        BeanWriter writer = new BeanWriter();
        writer.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(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.