I have been working on something else for awhile, but have come back to this
problem.� I now have the objects modeled correctly, with an Address base
class and a ResidentialAddress extended class that has the additional
ResidentailAddress field.� I am still having trouble with the mapping
however.� I have a Shipper object that has get/setAddress methods which take
the base Address object. �In the mapping file, how do I tell it to map an
Address or a ResidentialAddress depending on what is actually there to an
<Address> tag.� My first attempt was to try this:
�
<class name="com.test.stuff.Shipper" >
����� ...
����� <field name="Address" type="com.test.stuff.Address" >
����������� <bind-xml name="Address" />
����� </field>
����� <field name="Address" type="com.test.stuff.ResidentialAddress" >
����������� <bind-xml name="Address" />
����� </field>
</class>
�
Obviously, it didn't work because I am declaring the address field twice.�
Has anybody done something similar?
�
�
Thanks
-John
-----Original Message-----
From: Andrew Fawcett [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 31, 2005 9:02 AM
To: [email protected]
Subject: RE: [castor-user] Modeling and Mapping an empty and optional
element
�
Hi John,
�
You could maybe consider you using a base type and an extended type in your
schema?
�
I believe there is an example of this type of thing in the XML Schema
specification?
�
Cheers,
�
Andy.
�

From: John Prebula [mailto:[EMAIL PROTECTED] 
Sent: 31 May 2005 15:56
To: Castor Mailing List ([email protected])
Subject: [castor-user] Modeling and Mapping an empty and optional element
I am modeling an xml schema that has an address component, and the address
has a flag to indicate whether it is a residential address or not.� An
address should look like this if it is a residential address:
�
<Address>
       <AddressLine1>22 USShipperAddr1</AddressLine1>
����� <AddressLine2>USShipperAddr2</AddressLine2>
����� <AddressLine3>USShipperAddr3</AddressLine3>
����� <City>Plano</City>
����� <StateProvinceCode>TX</StateProvinceCode>
����� <PostalCode>75093</PostalCode>
����� <CountryCode>US</CountryCode>
����� <ResidentialAddress/>
</Address>
�
If the address is not residential, the element should not be there.� How do
I model and map this with castor?� I am using a boolean field in my Address
class, but I cannot figure out how to map it so that it does not appear when
I marshall the object and residentialAddress is false.� I always end up with
a <ResidentialAddress>false</ResidentialAddress>.
�
Thanks,
-John


The information contained in this message is confidential and proprietary
information that belongs to CRS Retail Systems, Inc. It is intended only for
the use of the individual or entity named above.
If the reader of this message is not the intended recipient, or the employee
or agent responsible to deliver it to the intended recipient, you are hereby
notified that any dissemination, distribution, use or copying of this
message is strictly prohibited.
If you have received this message in error, please immediately notify the
sender by replying to his/her e-mail address noted above and delete the
message. Thank you.



-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to