-----Message
d'origine-----
De : Arvin, Shawn POP/Exch)
[mailto:[EMAIL PROTECTED]
Envoyé : jeudi 15 avril 2004
15:06
À : '[EMAIL PROTECTED]'
Objet : Re: [castor-dev]
Using the reference attribute for xml mapping
Hi Jerome,
Thank you for your
response. I was able to get it working as you describe, my problem was that I
missed the part that the node had to be set to attribute. But not I am facing a
different problem. What happens when the field that is doing the referencing is
actually referencing an interface, where you could have instances of different
classes. What I am seeing here is that the unmarshalling to xml looks ok but I
can't go back from xml to java objects. Here is an example of the way I defined
my mapping:
<class name=" ComplexType"
identity="qualifiedName" >
<field name="qualifiedName" type="string"/>
</class>
<class name=" PrimitiveTypeEnum" identity="name"
verify-constructable="false">
<field name="name" type="string"/>
</class>
<class name=" Attribute">
<field name="type" type="TypeDescriptor" >
<bind-xml name="attr_type" node="attribute"
reference="true"/>
</field>
</class>
Both ComplexType and
PrimitiveTypeEnum classes implement the interface TypeDescriptor. The Attribute
Class has an attribute "type" of type TypeDescriptor. I don't see how
castor can determine from the xml output which class to instantiate since the
only thing that it outputs for the attr_type is the value and no class info.
Thanks
Shawn
-----Original Message-----
From: Pastre Jerôme
[mailto:[EMAIL PROTECTED]
Sent: Thursday, April 15, 2004
6:13 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Using
the reference attribute for xml mapping
This an
example of mapping file :
<class
name="pack3.lE" identity="leOid">
<field name="leOid" >
<bind-xml
node="attribute"/>
</field>
</class>
<class
name="pack3.aG" >
<field name="refLe"
type="pack3.lE" >
<bind-xml reference="true" node="attribute"/>
</field>
</class>
-----M essage d'origine-----
De : Arvin, Shawn POP/Exch)
[mailto:[EMAIL PROTECTED]
Envoyé : mercredi 14 avril
2004 21:32
À : '[EMAIL PROTECTED]'
Objet : [castor-dev] Using
the reference attribute for xml mapping
Hi,
I am using the xml mapping and
trying to figure out how the "identity" and "reference"
attributes are supposed to be used in
a mapping file?
Thanks,
Shawn