Dear Castor XML users,

I'm trying to unmarshall the following XML which at some point should result
in an ArrayList containing a Double(1.5), a String("Text") and another object
called Boundaries.

   <?xml version="1.0" encoding="UTF-8"?>
   <table ...>
      <map xsi:type="tableType" name="exampleTable">
         <column name="ExampleColumn">
            <!-- Double -->
            <value xsi:type="java:java.lang.Double">1.5</value>
            <!-- String -->
            <value xsi:type="java:java.lang.String">Text</value>
            <!-- Boundaries object -->
            <value xsi:type="boundariesType" lowerboundary-inclusive="0"
upperboundary-exclusive="15"/>
         </column>
      </map>
   </table>

The mapping file looks like this. 

   <class name="....Table">
      <map-to xml="tableType"/>
      ... 
      <!-- Put columns in a Map with key=columnName and value=ArrayList of
column values -->
      <field name="columns" collection="map">
         <bind-xml name="table:column">
            <class name="org.exolab.castor.mapping.MapItem">
               <field name="key" type="string">
                  <bind-xml name="name" node="attribute"/>
               </field>
               <!--
=============================================================
                  type="java.lang.Object" is needed to get this to work. Why? 
               ==============================================================
-->
               <field name="value" type="java.lang.Object"
collection="arraylist">
                  <bind-xml name="table:value" node="element"/>
               </field>
            </class>
         </bind-xml>
      </field>
   </class>

   <class name="my.package.Boundaries">
      <map-to xml="boundariesType"/>
      ...
  </class>

I CAN get this to unmarshall successfully but I need to specifiy the arraylist
field type as "java.lang.Object"!!!

I don't like that, I would rather:
1) ...set the type to "double" or "java.lang.Double" so I can skip the
xsi:type="java:java.lang.Double" in my XML. However, that gives me an "unable
to resolve reference: [EMAIL PROTECTED]" when reading
the boundariesType.
2) ...remove the type="java.lang.Object" completely, but that gives me a
NullPointerException in
org.exolab.castor.xml.util.XMLFieldDescriptorImpl.hashCode().

What's causing this? Are there any ways to set the (default) type to "double"?

Regards,
Martijn.




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

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

Reply via email to