Examples of enablePrettyPrint()


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

        String name = "John";
        addressBook.addAddressBookItem(name, johnsAddresses);
        StringWriter outputWriter = new StringWriter();
        outputWriter.write("<?xml version='1.0' ?>\n");
        BeanWriter beanWriter = new BeanWriter(outputWriter);
        beanWriter.enablePrettyPrint();
        beanWriter.write(addressBook);
   
        String xml =
            "<?xml version='1.0' ?>\n"
                + "  <AddressBook id=\"1\">\n"
View Full Code Here

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

        if ( bean == null ) {
            throw new Exception( "No bean read from the XML document!" );
        }
        BeanWriter writer = new BeanWriter();
        writer.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(false);
        writer.enablePrettyPrint();
        writer.write( bean );
    }
}
View Full Code Here

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

    public String writeBean(Object bean) throws Exception {
        StringWriter out = new StringWriter();
        out.write("<?xml version='1.0'?>");
        BeanWriter writer = new BeanWriter(out);
    writer.getBindingConfiguration().setMapIDs(false);
        writer.enablePrettyPrint();
        writer.write( bean );
        return out.getBuffer().toString();
    }
   
    /** @return the bean class to use as the root */
 
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().getConfiguration().setAttributesForPrimitives(false);
        writer.getBindingConfiguration().setMapIDs(false);
        writer.enablePrettyPrint();
        writer.write( bean );
    }
}
View Full Code Here

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

 
    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

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()

        // 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

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

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

        //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
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.