Umberto Angelini wrote:
I'm a newbie of Castor...
I build a sample ( see attached )
I generate the classes
I write this code

   FileReader reader=null;
   reader = new FileReader("Progetti.xml");
   Progetti prjs = new Progetti();
   prjs.unmarshal(reader);
   System.out.println(prjs.getProgetto().length);

I receive 0 ( zero ) without any error message !
The file seems to be empty...:(
Can you help me ?
I'm sure is a banal error.

Yep -- the problem is this pair of lines:


   Progetti prjs = new Progetti();
   prjs.unmarshal(reader);

The unmarshal method is static. It constructs a new instance and returns it. You want to do:


Progetti prjs = Progetti.unmarshal(reader);

HTH,
Rhett

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev




Reply via email to