Thanks for these examples.
I had look in M8 and M5 package, as well as in sourceforge's CVS
cayenne/tests repository in order to find out more about XMLencoder and
XMLdecoder, but couldn't get anything. Could you please point me out the
exact place where to find the examples you mention?
Besides, I noticed that relationship targets were encoded using the
default mapping (XMLSerializable.encodeAsXML) and not applying the entity
that matches their type, is there any way to change this behavior? for
instance, given the mapping:
<model>
<entity name="my.class.Parent" xmlTag="parent">
<property name="name" xmlTag="name"/>
<property name="childArray" xmlTag="children"/> <- 'child'
being a 0-N relationship.
</entity>
<entity name="my.class.Child" xmlTag="child">
<property name="nick" xmlTag="nickname"/>
</entity>
</model>
Using the above as a mapping for encoding a Parent object will give me xml
of the form below, where properties of a Child are encoded but not
relationships (default behavior):
<parent>
<name>Mary Lee</name>
<children
type="my.class.Child"><name>Tom</name><nick>Tomy</nick></children>
<children
type="my.class.Child"><name>Anna</name><nick>Anita</nick></children>
</parent>
While I am expecting something where the entity matching my.class.Child
would have been applied to every object of the childArray relationship:
<parent>
<name>Mary Lee</name>
<children>
<child><nick>Tomy</nick></child>
<child><nick>Anita</nick></child>
</children>
</parent>
Is there any way I can get such a behavior using mapping file? or should I
rather go for overrinding encodeAsXML in those objects? If possible I'd
prefer using a mapping file.
Thanks for any input.
Bertrand.
Cris Daniluk wrote on 08/12/2005:
>
> Attached are two sample mapping files from the XMLEncoder tests (you
> can see more examples if you get the 1.2 source)
>
> I didn't notice before, but a DTD is definitely notably absent from
> the examples.
>
> Cris
This archive was generated by hypermail 2.0.0 : Fri Dec 09 2005 - 04:43:03 EST