Thanks guys!
Both of your posts helped! I am rolling now!
On Thu, 20 Jan 2005 17:21:38 -0600, Keith Visco <[EMAIL PROTECTED]> wrote:
>
> Another solution is to simply pass in ArrayList as the root and use a
> mapping file to define the tester class, such as:
>
> Mapping myMapping = new Mapping();
> myMapping.loadMapping("tester-mapping.xml");
>
> Ummarshaller unm = new Unmarshaller(ArrayList.class);
> unm.setMapping(myMapping);
> ArrayList list = (ArrayList)unm.unmarshal(myReader);
>
> You will need to make sure that the tester class is public and has
> public access methods however.
>
> Hope that helps,
>
> --Keith
>
>
> Bruce Snyder wrote:
> > On Thu, 20 Jan 2005 14:18:01 -0600, Thomas O'Neill <[EMAIL PROTECTED]>
> > wrote:
> >
> >
> >>I have some XML that contains many objects of the same type. Like so:
> >>
> >>class tester {
> >> private String name;
> >> private String age;
> >>}
> >>
> >><testers>
> >> <tester>
> >> <name>Tom</name>
> >> <age>24</age>
> >> </tester>
> >> <tester>
> >> <name>Anni</name>
> >> <age>23</age>
> >> </tester>
> >></testsers>
> >>
> >>My question is, how can i set this up so that castor will unmarshall
> >>this xml to an array of tester objects? Is this possible? Is there a
> >>better way to do this?
> >
> >
> > Tom,
> >
> > You need to create the Testers object that allows an array of Tester
> > objects as well as the utility methods to handle the array. You may
> > also need to create a mapping descriptor to tell Castor XML how to map
> > the XML into the Java objects.
> >
> > The easiest way to handle this is to start by creating an XSD to
> > represent the object model and then use the Source Generator to
> > generate the POJOs for the object model. One reason I suggest this is
> > that the objects generated by the Source Generator will contain all
> > the needed utility methods and if the object model ever needs to
> > change, then you just change the XSD and run it through the Source
> > Generator again.
> >
> > Bruce
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-user
>
--
Tom O'Neill
[EMAIL PROTECTED]
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user