Hi,

 I have a structure that I want to use in different contexts with different
names, but I'm not being able to do it.

As an example consider the following mapping:


 <mapping class=*"com.sample.Person"* name=*"Person"* ns=*"
http://www.sample.com/"*>

   <value name=*"Name"* get-method=*"getName"* set-method=*"setName"* usage=
*"required"* />

   <value name=*"Age"* get-method=*"getAge"* set-method=*"setAge"* usage=*
"required"* />

</mapping>


 I want to use the class (Person) mapped by the previous mapping in
different contexts where it is serialized as an element named “Client” or a
“Friend”. Here are the different mappings were Person will be used (Note
that getClient and getFriend return a Person).


 <mapping class=*"com.sample.Client"* name=*"BestClient"* ns=*"
http://www.sample.com/"* ordered=*"false"*>

   <structure get-method=*"getClient"* set-method=*"setClient"* usage=*
"required"*/>

</mapping>


 <mapping class=*"com.sample.Friend"* name=*"AddDestination"* ns=*"
http://www.sample.com/"* ordered=*"false"*>

   <structure get-method=*"getFriend"* set-method=*"setFriend"* usage=*
"required"*/>

</mapping>


 The intended serialization would be:

<BestClient>

  <Client>

    <Name>*Jonh*</Name>

    <Age>30</Age>

  </Client>

</BestClient>


 But the serialization result is, for the client sample:

   <BestClient>

  <Person>

    <Name>*Jonh*</Name>

    <Age>30</Age>

  </Person>

</BestClient>


 Using “name” attribute in structure doesn't work (“Error: name attribute
not allowed on concrete mapping reference”)


 <mapping class=*"com.sample.Client"* name=*"BestClient"* ns=*"
http://www.sample.com/"* ordered=*"false"*>

  <structure name=”Client” get-method=*"getClient"* set-method=*"setClient"*
usage=*"required"*/>

</mapping>


 Any ideas on how to overcome this problem?


 Thanks,

Luís M. Costa
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to