Switch on formatted output. This sets the end of line and the indent. The default is adding 2 spaces and a newline
54555657585960616263
} public void write(Object bean) throws Exception { BeanWriter writer = new BeanWriter(); writer.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(false); writer.enablePrettyPrint(); writer.write( bean ); } }