StringWriter out = new StringWriter();
out.write("<?xml version='1.0'?>");
BeanWriter writer = new BeanWriter(out);
writer.getBindingConfiguration().setMapIDs(false);
Channel channel = new Channel();
channel.setTitle("Betwixt News");
channel.setLink("http://jakarta.apache.org/commons/betwixt");
channel.setDescription("Example feed themed on Betwixt news.");
channel.setRating("(PICS-1.1 'http://www.rsac.org/ratingsv01.html'" +
" 2 gen true comment 'RSACi North America Server'" +
" for 'http://www.rsac.org' on '1996.04.16T08:15-0500'" +
" r (n 0 s 0 v 0 l 0))");
channel.setLanguage("en-UK");
Image image = new Image();
image.setTitle("Apache Feather");
image.setURL("http://www.apache.org/images/asf_logo_wide.gif");
image.setLink("http://www.apache.org");
image.setWidth(100);
image.setHeight(30);
image.setDescription("Example image");
channel.setImage(image);
Item itemOne = new Item();
itemOne.setTitle("Betwixt now generates w3c schema!");
itemOne.setLink("http://jakarta.apache.org/commons/betwixt");
itemOne.setDescription("Example description");
channel.addItem(itemOne);
Item itemTwo = new Item();
itemTwo.setTitle("Another News Item");
itemTwo.setLink("http://jakarta.apache.org/commons/betwixt");
itemTwo.setDescription("Blah Blah Blah");
channel.addItem(itemTwo);
TextInput textInput = new TextInput();
textInput.setTitle("Send");
textInput.setDescription("Comments about Betwixt news");
textInput.setName("Response text");
textInput.setLink("http://jakarta.apache.org/commons/betwixt");
channel.setTextInput(textInput);
writer.write(channel);
String xml = out.getBuffer().toString();