Hi Keith,

Sorry for the email but I couldn't find the resolution to this problem in
the archive.  If it has been solved could you send me the link?

Thanks,
Scott

-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 07, 2002 4:58 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] marshalling of arraylist yields different
results with and without mapping file



Hi Tung,

It's a bug as the second result (without the xsi:type) information
should be the default. The first result should be when container="true",
but since your mapping file doesn't have that, it's a bug.

Of course fixing it will cause the behavior to change and break some
peoples code which means we need to come up with a way of fixing it that
doesn't break the current behavior. My feeling is that by default
collections will be handled via the mapping file as container="true",
and you'll have to force it the second behavior by using
container="false". This will allow existing mapping files to work as
they have been, and people writing new mapping files can still get the
behavior they desire.

Can you report this via http://bugzilla.exolab.org (include your test
case) and we'll try and get it fixed before the release.

Thanks,

--Keith

"Mansfield, Tung" wrote:
>
> I have the following mapping file:
>
> <?xml version="1.0"?>
> <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version
> 1.0//EN"
>                                  "http://Castor.exolab.org/mapping.dtd";>
> <mapping>
>         <class name="TestObject">
>                 <map-to xml="testObject"/>
>                 <field name="objects" collection="arraylist"
> type="TestObject1">
>                         <bind-xml name="testObject1"/>
>                 </field>
>         </class>
>         <class name="TestObject1">
>                 <map-to xml="testObject1"/>
>                 <field name="i" type="integer">
>                         <bind-xml node="element"/>
>                 </field>
>                 <field name="j" type="integer">
>                         <bind-xml node="element"/>
>                 </field>
>         </class>
> </mapping>
>
> The result of the marshal looks like this:
>
> <testObject>
>     <testObject1>
>         <i>1</i>
>         <j>0</j>
>     </testObject1>
>     <testObject1>
>         <i>2</i>
>         <j>0</j>
>     </testObject1>
> </testObject>
>
> When the mapping file is empty (<mapping/>), the result looks like this.
>
> <testObject>
>     <objects xsi:type="java:java.util.ArrayList"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>         <testObject1 xsi:type="java:TestObject1">
>             <j>0</j>
>             <i>1</i>
>         </testObject1>
>         <testObject1 xsi:type="java:TestObject1">
>             <j>0</j>
>             <i>2</i>
>         </testObject1>
>     </objects>
> </testObject>
>
> The two results should be the same. Given a choice, I prefer the second
> result because of the objects tag. There should be a way in which you can
> specify in the mapping file or castor.properties which result to create.
>
> I believe this problem occurs for all collections. I encountered a similar
> problem dealing with Hashtable.
>
> Attached is the zip file containing my sources.
>
>  <<testList.zip>>
>
>   ------------------------------------------------------------------------
>                    Name: testList.zip
>    testList.zip    Type: Zip Compressed Data
(application/x-zip-compressed)
>                Encoding: base64

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to