commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinicius Caldeira Carvalho <vinicius.carva...@squadra.com.br>
Subject Digester simple, simple question
Date Fri, 10 Dec 2004 12:07:16 GMT
Hi there! I'd like a little help with diggester. I tried the receipt and 
it didn't work for me ...
Here's what I have:
my xml:

<user-data>
	<user name="Vinicius Carvalho" age="25"/>
	<user name="Clarissa Daguer" age="23"/>
</user-data>


the method to instantiate  the bean:

clazz = org.vinicius.User.class;

File input = new File(path);
		Digester digester = new Digester();
		digester.setValidating(false);
	
digester.addObjectCreate("user-data","java.util.ArrayList");
	
digester.addObjectCreate("user-data/user",clazz.getName());
		digester.addSetProperties("user-data/user");		
	
digester.addSetNext("user-data/user","add",clazz.getName());
		Object obj = null;
		try {
			 obj = digester.parse(input);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SAXException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return obj;


The bean is a simple userBean with name and age properties.
What I'd like to do is to have an arrayList of users returned to me.

What am I doing wrong



---------------------------------------------------------------------
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