"Sin Chada, Veerpal" wrote:
>
> Thank you Keith
>
> I could not find container attribute in field element in mapping.dtd.
> niether any ref. or doc. could u tell me where i can read about it.
>
> thanks
> VS
It's listed in the mapping.xsd file, the mapping.dtd apparently needs to
be updated to support this.
You actually don't need to use it however, I misunderstood how you were
trying to marshal/unmarshal ListDO.
try the following:
<field name="state" type="my.package.ListDO" required="false"/>
<bind-xml node="element" name="state"/>
</field>
And add the class mapping for ListDO as such
<class name="my.package.ListDO">
<field name="id" type="string">
<bind-xml node="attribute"/>
</field>
<field name="name" type="string">
<bind-xml node="text"/>
</field>
</class>
That *should* work. If it doesn't, let me know.
Thanks,
--Keith
>
> -----Original Message-----
> From: Keith Visco [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 04, 2001 5:46 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] XML mapping
>
> "Sin Chada, Veerpal" wrote:
> >
> > I have problem, how to..
> >
> > i have XML file below
> > - <Patients>
> > - <Patient pk="1234">
> > <last_name>adha</last_name>
> > <first_name>erpal</first_name>
> > <state id="1818:1011">NY</state>
> > <country id="8181:9191">USA</country>
> > <race>East Indian</race>
> > <address1>12 ekta avenue</address1>
> > <address2>circular road</address2>
> > <refering_physician_key>1912:8181</refering_physician_key>
> > </Patient>
> > - <Patient pk="4334">
> > <last_name>Cdhaf</last_name>
> > <first_name>rpadfl</first_name>
> > <state id="1818:1012">NY</state>
> > <country id="8181:9121">USA</country>
> > <race>Indian</race>
> > <address1>12 ekta avenue</address1>
> > <address2>circular road</address2>
> > <refering_physician_key>1912:8181</refering_physician_key>
> > </Patient>
> >
> > </Patients>
> >
> > i have patient class
> > public class PatientDO
> > {
> > private String address1;
> > private String city;
> > private String zip;
> > private String homePhone;
> > private ListDO sex; // ?
> >
> > private ListDO state;
> > private ListDO country;
> > private ListDO salutation;
> > private ListDO race;
> > private String first_name;
> > private String last_name;
> > }
> >
> > public class ListDO implements java.io.Serializable
> > {
> > public String objid;
> > public String name;
> > }
> >
> > I am unable to map ListDO to state, country ..
>
> <field name="country" type="my.package.ListDO" container="true"/>
>
> > I am unable to map patient because i have patient class only and patients
> is
> > just XML strcuture to encapsulate all patients.
>
> Just create a simple Patients class that holds your collection of
> Patient objects that you can use during Marshalling/Unmarshalling:
>
> Something like:
>
> Patients {
>
> private <CollectionType> _patients = null;
>
> //-- Default constructor needed for unmarshalling
> public Patients() {
> _patients = new <CollectionType>
> } //-- Patients
>
> public void addPatient(Patient p) {
> _patients.add<...>(p);
> }
> public Enumeration getPatients() {
> return _patients.<...>;
> } //-- getPatients
>
> /// ... any other methods you may want ...
>
> } //-- class: Patients
>
> It's lightweight and can simply be discarded after you finish
> unmarshalling.
>
> --Keith
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev