writer = new BeanWriter(out);
writer.setWriteEmptyElements(true);
writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
writer.getBindingConfiguration().setMapIDs(false);
writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new CapitalizeNameMapper());
writer.write("CarryOn", names);
xml = "<?xml version='1.0'?><CarryOn><Names>"
+ "<Name><Name>Sid James</Name></Name>"
+ "<Name><Name>Kenneth Williams</Name></Name>"
+ "<Name><Name>Joan Simms</Name></Name>"
+ "<Name><Name>Charles Hawtrey</Name></Name>"
+ "</Names>"
+"</CarryOn>";
xmlAssertIsomorphicContent(
parseString(out.getBuffer().toString()),
parseString(xml),
true);
ArrayList things = new ArrayList();
things.add(new NameBean("Sugar"));
things.add(new NameBean("Spice"));
things.add(new NameBean("All Things Nice"));
NoAdderBean bean = new NoAdderBean();
bean.setThings(things);
out = new StringWriter();
out.write("<?xml version='1.0'?>");
writer = new BeanWriter(out);
writer.setWriteEmptyElements(true);
writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
writer.getBindingConfiguration().setMapIDs(false);
writer.write(bean);
xml = "<?xml version='1.0'?><NoAdderBean><things>"
+ "<NameBean><name>Sugar</name></NameBean>"
+ "<NameBean><name>Spice</name></NameBean>"
+ "<NameBean><name>All Things Nice</name></NameBean>"
+ "</things>"
+"</NoAdderBean>";
xmlAssertIsomorphicContent(
parseString(out.getBuffer().toString()),
parseString(xml),
true);
out = new StringWriter();
out.write("<?xml version='1.0'?>");
writer = new BeanWriter(out);
writer.setWriteEmptyElements(true);
writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(true);
writer.getBindingConfiguration().setMapIDs(false);
writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new CapitalizeNameMapper());
writer.write(bean);
xml = "<?xml version='1.0'?><NoAdderBean><Things>"
+ "<NameBean><Name>Sugar</Name></NameBean>"
+ "<NameBean><Name>Spice</Name></NameBean>"