Keith,

Thank you for the reply. I saw your earlier message on this issue and I did
try new code from CVS before I posted to the list. I might be msitaken, but
I think the problem that people reported was slightly different from the one
that I have:

This works fine with the new code:

        <field name="B1" type="B"> 
            <bind-xml name="B1" node="attribute" location="B"/> 
        </field> 

        <field name="B2" type="B"> 
            <bind-xml name="B1" node="attribute" location="B"/> 
        </field> 

But this still does not work on unmarshalling:

           <field name="B1" type="B">
         <bind-xml name="B" node="element" location="B1"/>
         </field>
         <field name="B2" type="B">
             <bind-xml name="B" node="element" location="B2"/>
         </field>

( the corresponding java code and xml are in my original message )

Also, I noticed that when the same name of the xml element is used inside
and outside of location tags, it also results in error during unmarshalling,
but marshalling works fine. For example

java:

        public B getB();
        public B getB1();

mapping:         
         <field name="B" type="B">
                <bind-xml name="B" node="element"/>
         </field>
         <field name="B2" type="B">
             <bind-xml name="B" node="element" location="B2"/>
         </field>
xml:
        <B>blah</B>
      <B2><B>blah</B></B2>


It is possible to create a mapping file to support this? Any insight is
greatly appreciated.

Thank you,
Yelena


-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 01, 2003 3:25 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Problems with Location attribute in <bind-xml>



Yelena,

This issue was fixed last week in the CVS version, so if you can grab
the sources from CVS and run the build script. More information on our
CVS server can be found here: http://castor.exolab.org/cvs.html

--Keith

"Kiyko, Yelena" wrote:
> 
> Hi,
> 
> I'm having problems unmarshalling objects with the location attribute when
> the field with the same name occurs within different "locations". Here is
a
> simplified example:
> 
> public class A
> {
>         B getB1();
>         B getB2();
> }
> public class B
> {
>         String getName();
> }
> 
> I want the result XML to look like this:
> 
> <A>
>     <B1>
>         <B>
>                 <name>blah<name>
>         <B>
>    <B1>
>    <B2>
>         <B>
>                 <name>blah<name>
>         <B>
>    <B2>
> </A>
> 
> In other words, I need to add a "wrapper" element to class B, and I'm
trying
> to achieve it using location attribute. Here is the mapping file:
> 
> <mapping>
> >     <description></description>
> >     <class name="A">
> >         <map-to xml="A"/>
> >
> >         <field name="B1" type="B">
> >             <bind-xml name="B" node="element" location="B1"/>
> >         </field>
> >         <field name="B2" type="B">
> >             <bind-xml name="B" node="element" location="B2"/>
> >         </field>
> >      </class>
> 
>         <class name="B">
> >         <map-to xml="B"/>
> >         <field name="name" type="java.lang.String">
> >             <bind-xml name="name" node="element"/>
> >         </field>
> >      </class>
> 
> > </mapping>
> 
> This results in TypeConversion error during unmarshalling - "unable to add
> 'B' to <null>, could not set value of B1(B) to (B). Marshalling works as
> expected.
> 
> Am i misunderstanding the "location" functionality? Is there other way to
> add a "wrapper" xml element for a class?
> 
> Many thanks,
> Yelena
> 
> 
> -----------------------------------------------------------
> 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