Hello Keith,
Thank you for your suggestion, but I get a new problem. Using the current
mapping file (maybe there is something wrong), I only get the value of date,
but the value of time is null.
I already exchange the order of date and time variables/methods in input XML,
mapping file and Java classes, but no effect. And also if I am using the same
mapping file, the result is not what I expect. It only generates structure
like:
<appointment>
    <date>20001101</date>
</appointment>

What is wrong here ? Any suggestion ?
Thank you.

Regards,
Agustinus Tedja
Technische Universit�t Hamburg-Harburg
Telematik Arbeitsbereich


> > XML format:
> >  <appointment>
> >       <date>20001101</date>
> >       <time>1500</time>
> >  </appointment>
> >
> > Java class:
> > public class Message {
> >     Request _request;
> >
> >     public void setRequest(Request req) {
> >         _request = req;
> >     }
> >     public Request getRequest(){
> >         return _request;
> > }
> >
> > public class Request {
> >     Appointment _appointment;
> >
> >     public void setAppointment(Appointment  app) {
> >         _appointment = app;
> >     }
> >     public Appointment getAppointment(){
> >         return _appointment;
> > }
> >
> > public class Appointment {
> >     String _date, _time;
> >     public String getDate(){return _date;}.
> >     public void setDate(String date){_date = date;}
> >     public String getTime(){return _time;}.
> >     public void setDate(String time){_time = time;}
> > }
> >
> > Thus, the Java classes are expected to generate a new XML :
> > <message>
> >     <request>
> >         <appointment>
> >             <date>20001101</date>
> >             <time>1500</time>
> >         </appointment>
> >     </request>
> > </message>
> >
> > It appears that the mapping file below does not give expected result.
> > <mapping>
> >          <class name="Message">
> >                  <field name="Request"
> >                         type="Request">
> >                          <bind-xml name="request" node="element"/>
> >                  </field>
> >          </class>
> >          <class name="Request">
> >                  <field name="Appointment"
> >                         type="Appointment">
> >                          <bind-xml name="appointment" node="element"/>
> >                  </field>
> >          </class>
> >          <class name="Appointment">
> >                  <map-to xml="appointment"/>
> >                  <field name="date"
> >                         type="java.lang.String">
> >                          <bind-xml name="date" node="element"/>
> >                  </field>
> >                  <field name="time"
> >                         type="java.lang.String">
> >                          <bind-xml name="time" node="element"/>
> >                  </field>
> >          </class>
> >  </mapping>
> >
> > It will give message error that the class for the root element
> > 'appointment' could not be found.
> > Can I skip the Message and Request classes, and directly pointing to
> > Appointment, because it is obvious that Message and Request classes have
> > no link to XML input ? And I intend to use the same mapping file for
> > marshalling to generate new XML.
> > Thanks for any suggestion.
> >
> > Regards,
> > Agustinus Tedja
> > Technische Universit�t Hamburg-Harburg
> > Telematik Arbeitsbereich
> >
> > -----------------------------------------------------------
> > 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

Reply via email to