Hi Dragos,

The following should do the trick:


   <class name="com.acme.Url">
      <map-to xml="url">
      <field name="kind" type="string">
         <bind-xml node="attribute"/>
      </field>
      <field name="value" type="string">
         <bind-xml node="text"/>
      </field>
   </class>

Hope that helps,

--Keith

Dragos Haiduc wrote:
> 
> If possible, it should be a simple JavaBean, something like:
> 
> public class Url {
> //e.g. "zip"
> private String kind;
> //e.g. "http://www.eurosport.com/gifs.zip";
> private String value;
> 
> //=== proper getters and setters to follow for the 2 fields====
> }
> 
> I couldn't figure out how the mapping file should look like in order to
> be able to properly map the field "value" to the below <url> element.
> Thanks again.
> Dragos
> 
> Keith Visco wrote:
> 
> >
> >Yes, Castor can handle that XML, but what does the Object look like that
> >you're trying to map it to?
> >
> >--Keith
> >
> >Dragos Haiduc wrote:
> >
> >
> >>Hello.
> >>
> >>Is it possible to map the following XML element to a Java object using
> >>the castor-xml framework?
> >>If yes, could you please let me know how?
> >>
> >>Here comes the sequence:
> >>.................................
> >><url kind="zip"> http://www.eurosport.com/gifs.zip</url>
> >>.................................
> >>
> >>Please note that changing the XML document structure is not an option.
> >>Thank you very much for your help.
> >>
> >>Dragos
> >>
> >>-----------------------------------------------------------
> >>If you wish to unsubscribe from this mailing, send mail to
> >>[EMAIL PROTECTED] with a subject of:
> >>        unsubscribe castor-user
> >>
> >>
> >
> >
> >
> >-----------------------------------------------------------
> >If you wish to unsubscribe from this mailing, send mail to
> >[EMAIL PROTECTED] with a subject of:
> >        unsubscribe castor-user
> >
> >
> >
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-user



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

Reply via email to