commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Keese <bi...@tech.beacon-it.co.jp>
Subject Re: Digester simple, simple question
Date Tue, 14 Dec 2004 02:15:44 GMT
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.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
>
>
>

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