commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Nedelcoux <anedelc...@octo.com>
Subject Betwixt question
Date Tue, 27 Sep 2005 11:41:56 GMT
Hi, 
I'm trying to use betwixt in order to load some XML files into Java beans.
The structure I'm trying to load is the following:
<root>
	<line>
		<entry>some data</entry>
		<entry>some data 2</entry>
		...
	</line>
	<line>
		<entry>some data 3</entry>
		<entry>some data 4</entry>
		...
	</line>
</root>

I am using the following betwixt mapping (inspired by the tutorial):

<?xml version="1.0" encoding="UTF-8" ?>
<info>
    <element name='root'>
	    <element name='line' property='lines' class='Line'>
        	<element name='entry' property='entries'/>
        	<addDefaults/>
        </element>
    </element>
</info>

The Java classes are the following:

public class Root {

	private List lines = new ArrayList();
	
	public List getLines() {
      	return lines;
    	}
    
    	public void addLine(Line line) {
    		lines.add(line);
    	}
}

public class Line {
	private List entries = new ArrayList();
	
	public List getEntries() {
        	return entries;
    	}
	
	public void addEntry(String entry) {
    		entries.add(entry);
    }
}

I feel my case is quite basic but I can't make it work: it never reaches the
"entry" level in the xml file.
Am I using betwixt in a wrong way? Is there any specificity that makes
betwixt unusable in my case?

Thanks for your help.

André


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message