The code:
        
        digester.addSetNext("user-data/user","add",clazz.getName());

will call ArrayList.add(userObject).  I don't see the problem.



Marco Mistroni wrote:

Hello,
        I thought I have replied this question earlier..
Fact is that you are instantiating an arrayList as topmost element

Now, the arrayList class does not have a setUser method..
It has only  add(..)

You'd need to add a  CallMethod rule, that whenever you find a user,
digester is going to call the 'add' method with the user parameter

Regards
        marco

-----Original Message-----
From: José Antonio Pérez Testa [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 09:44
To: Jakarta Commons Users List
Subject: Re: Digester simple, simple question


IMO the problem is related again with the stack.
try ...


Bill Keese wrote:



This looks OK to me; I'm not sure why it's failing. What happens? Does it create an ArrayList but no objects are added to it? You should probably turn on tracing to figure out what is happening.

Vinicius Caldeira Carvalho wrote:



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.push(new 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



------------------------------------------------------------------------
-------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo,
contiene información de carácter confidencial exclusivamente dirigida a
su destinatario o destinatarios. Queda prohibida su divulgación, copia o
distribución a terceros sin la previa autorización escrita de Indra. En
el caso de haber recibido este correo electrónico por error, se ruega
notificar inmediatamente esta circunstancia mediante reenvío a la
dirección electrónica del remitente.

The information in this e-mail and in any attachments is confidential
and solely for the attention and use of the named addressee(s). You are
hereby notified that any dissemination, distribution or copy of this
communication is prohibited without the prior written consent of Indra.
If you have received this communication in error, please, notify the
sender by reply e-mail

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to