Daniel-

I believe when Castor sees the reference="true" attribute, it
*assumes* the object will be marshalled elsewhere in the document.
This causes Castor to only produce a reference, and not fully marshal
the child object.  To force your keys to be fully marshalled, I
believe they will have to appear outside of the DeviceModel objects.
A quick solution that might work is create a heterogeneous Collection
that includes all the keys and models then marshal that Collection.

BTW Hi Werner!  (creeps back into lurker status)

HTH,
Stephen


On Thu, Apr 17, 2008 at 10:59 AM, Daniel Wachter <[EMAIL PROTECTED]> wrote:
> Hi werner
>
>  I read the the reference how-to, but I don't get it to work as I would.
>  The keys appears in on the model, but where are the key definitions?
>
>  I read the reference many times, but not getting it working...
>  Can you give me some hints what are my problems?
>  Thank you
>  Daniel
>
>
>
>  I made a mapping like this:
>  ---------------------------------------------
>  <?xml version="1.0"?>
>  <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
>  "http://castor.org/mapping.dtd";>
>
>  <mapping>
>
>         <class name="com.solarmax.maxsim.model.Datakey" identity="id">
>                 <map-to xml="data-key" />
>                         <field name="id" type="string">
>                                 <bind-xml name="id" node="attribute" />
>                         </field>
>
>                         <field name="description" type="string">
>                                 <bind-xml name="description" node="attribute" 
> />
>                         </field>
>         </class>
>
>         <class name="com.solarmax.maxsim.model.DeviceModel">
>                 <map-to xml="model" />
>                         <field name="name" type="string">
>                                 <bind-xml name="name" node="element" />
>                         </field>
>
>                         <field name="attributes" 
> type="com.solarmax.maxsim.model.Datakey"
>  collection="collection">
>                                 <bind-xml name="data-key" reference="true" />
>                         </field>
>         </class>
>
>  </mapping>
>
>
>  And get a xml file like this:
>  ---------------------------------------------
>  <models>
>     <model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  xsi:type="model">
>         <name>S 2000C</name>
>         <data-key>rad</data-key>
>         <data-key>rad_e_day</data-key>
>         <data-key>rad_e_month</data-key>
>         <data-key>rad_e_tot</data-key>
>         <data-key>rad_e_year</data-key>
>         <data-key>status_alarm</data-key>
>         <data-key>status_system_new</data-key>
>     </model>
>     <model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  xsi:type="model">
>         <name>S 4000C</name>
>     </model>
>     <model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  xsi:type="model">
>         <name>S 5000C</name>
>     </model>
>  </models>
>
>
>
>  On Thu, 17 Apr 2008 16:41:37 +0200, Werner Guttmann
>  <[EMAIL PROTECTED]> wrote:
>  > You might want to have a look at
>  >
>  > http://castor.org/how-to-use-references-in-xml.html
>  >
>  > to get you started.
>  >
>  > Werner
>
>
>
>
> ---------------------------------------------------------------------
>  To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to