[prev in list] [next in list] [prev in thread] [next in thread] 

List:       castor-dev
Subject:    Re: [castor-dev] Castor XML - duplicate bind-xml names
From:       "Narinder Gaheer" <ngaheer () callidussoftware ! com>
Date:       2005-03-01 18:58:29
Message-ID: A11D6814C30D834BB77F66C4E66D307B131441 () ms-sequoia-l ! callidussoftware ! com
[Download RAW message or body]



This is a multi-part message in MIME format.

--MML_1109703507_8029@8641.exolab.org
content-class: urn:content-classes:message
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

If it was me, I would have created an object named
ContractCumPayment.java
and have a switch with in this Object i.e methods like isContract() and
isPayment() based on a particular bean property being set or not.
Ofcourse it convolutes the API with in your system but that's the best
you can do here.

Just my 2 cents.

Narinder



-----Original Message-----
From: david.hyne@usbank.com [mailto:david.hyne@usbank.com] 
Sent: Tuesday, March 01, 2005 10:25 AM
To: castor-dev@exolab.org
Subject: [BULK] - Re: [castor-dev] Castor XML - duplicate bind-xml names


We are using legacy system that does not conform to XML model. Our
enterprise code has to read the way it was presented. Do you know of
if-else switch we could do in Castor mapping.xml file?

Thanks,

David



|---------+---------------------------->
|         |           "Keith Visco"    |
|         |           <keith@kvisco.com|
|         |           >                |
|         |                            |
|         |           02/28/2005 02:39 |
|         |           PM               |
|         |           Please respond to|
|         |           castor-dev       |
|         |                            |
|---------+---------------------------->
 
>-----------------------------------------------------------------------
-------------------------------------------------------|
  |
|
  |       To:       castor-dev@exolab.org
|
  |       cc:
|
  |       Subject:  Re: [castor-dev] Castor XML - duplicate bind-xml
names                                                       |
 
>-----------------------------------------------------------------------
-------------------------------------------------------|





Hi David,

How do you distinguish between whether something is a Contract or a
Payment if they both use the Contract element name?

Castor basically follows the rules set forth in XML Schema, which
doesn't allow two sibling elements to have the same name and different
types. Basically if you have to look at the child-elements to determine
the type it's not going to work well. Castor determines the type before
examining the child elements.

--Keith

david.hyne@usbank.com wrote:
> Hi,
>
> I have a Response POJO that has two attributes: contracts and
payments.
The
> XML message I receive from SOAP for the <Response/> element can have
only
> one sub-element whether contract or payment, cannot be both at the
same
> time. Castor gives error because I have two same bind-xml element
names
> (contract and payment have the same element name <Contract/>). How do
you
> work around this issue?
>
> <Response>
>   <Contract primaryKey="">
>   </Contract>
> </Response>
>
> <class name="com.domain.function.Response">
>  <field name="_contracts" type="com.domain.function.Contract"
collection=
> "arraylist" set-method="setContracts" get-method="getContracts">
>       <bind-xml name="Contract"/>
>  </field>
>  <field name="_payments" type="com.domain.function.Payment"
collection=
> "arraylist" set-method="setPayments" get-method="getPayments">
>       <bind-xml name="Contract"/>
>  </field>
> </class>
>
> <class name="com.domain.function.Contract">
>  ...
> </clase>
>
> <class name="com.domain.function.Payment">
>  ...
> </clase>
>
>
>
>
>
------------------------------------------------------------------------
------

> Electronic Privacy Notice. This e-mail, and any attachments, contains
information that is, or may be, covered by electronic communications
privacy laws, and is also confidential and proprietary in nature. If you
are not the intended recipient, please be advised that you are legally
prohibited from retaining, using, copying, distributing, or otherwise
disclosing this information in any manner. Instead, please reply to the
sender that you have received this communication in error, and then
immediately delete it. Thank you in advance for your cooperation.
>
========================================================================
======

>
>
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> minimalist@exolab.org with a subject of:
>         unsubscribe castor-dev
>
>



-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
minimalist@exolab.org with a subject of:
        unsubscribe castor-dev





------------------------------------------------------------------------
------
Electronic Privacy Notice. This e-mail, and any attachments, contains
information that is, or may be, covered by electronic communications
privacy laws, and is also confidential and proprietary in nature. If you
are not the intended recipient, please be advised that you are legally
prohibited from retaining, using, copying, distributing, or otherwise
disclosing this information in any manner. Instead, please reply to the
sender that you have received this communication in error, and then
immediately delete it. Thank you in advance for your cooperation.
========================================================================
======



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
minimalist@exolab.org with a subject of:
        unsubscribe castor-dev


--MML_1109703507_8029@8641.exolab.org
Content-Type: text/plain; charset=us-ascii; name="footer"
Content-Transfer-Encoding: 8bit

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
minimalist@exolab.org with a subject of:
        unsubscribe castor-dev

--MML_1109703507_8029@8641.exolab.org--
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic