commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acec acec <>
Subject Betwixt output a List
Date Tue, 20 Jan 2009 14:43:26 GMT
I defined the following two classes and used the following code to get XML string. 

Here is the one result:

For List attribute, I do not want to have <InvoiceLineModList>. How can I define InvoiceMod.betwixt?

Thanks a lot.


		StringWriter outputWriter = new StringWriter();

		// Betwixt just writes out the bean as a fragment
		// So if we want well-formed xml, we need to add the prolog
		outputWriter.write("<?xml version=\"1.0\"?>");
		// Create a BeanWriter which writes to our prepared stream
		BeanWriter beanWriter = new BeanWriter(outputWriter);

		// Configure betwixt
		beanWriter.getXMLIntrospector().getConfiguration().setElementNameMapper(new CapitalizeNameMapper());


		String xmlString =  outputWriter.toString();

public class InvoiceMod {
	private String txnID;

	private List<InvoiceLineMod> invoiceLineModList = new ArrayList<InvoiceLineMod>();
	public String getTxnID() {
		return txnID;

	public void setTxnID(String txnID) {
		this.txnID = txnID;
	public List<InvoiceLineMod> getInvoiceLineModList() {
		return invoiceLineModList;

	public void addInvoiceLineMod(InvoiceLineMod invoiceLineMod) {

public class InvoiceLineMod {
	private String txnLineID;
	private Integer quantity;

	public String getTxnLineID() {
		return txnLineID;

	public void setTxnLineID(String txnLineID) {
		this.txnLineID = txnLineID;

	public Integer getQuantity() {
		return quantity;

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;

Looking for the perfect gift? Give the gift of Flickr!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message