commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Mistroni" <>
Subject RE: Digester simple, simple question
Date Fri, 10 Dec 2004 12:51:26 GMT
	I believe you need to have a rule for calling a method...
Your code is creating an ArrayList, but how are you adding elements to

One way to do that is to write your own class that extends arrayList.
You write ur method, let's say 'addUser', and hten you have to have
A call method rule that adds users to your class..

Something like this

<call-method-rule pattern="user-data/user" methodname="addUser"
	                paramcount="0" />

ok this is using an xml file for defining digester rules...but using the
rule in java code is the same...


-----Original Message-----
From: Vinicius Caldeira Carvalho
Sent: 10 December 2004 12:07
Subject: Digester simple, simple question

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 name="Vinicius Carvalho" age="25"/>
	<user name="Clarissa Daguer" age="23"/>

the method to instantiate  the bean:

clazz = org.vinicius.User.class;

File input = new File(path);
		Digester digester = new Digester();
		Object obj = null;
		try {
			 obj = digester.parse(input);
		} catch (IOException e) {
			// TODO Auto-generated catch block
		} catch (SAXException e) {
			// TODO Auto-generated catch block
		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:
For additional commands, e-mail:

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

View raw message