I have a simple TestClass consisting of a single field that is a 2D
array:
  public float[][] array;

(and a constructor to initialize the array).

Using Castor's default class inspection stuff, an instance of this class
can be converted into xml.

If I then attempt to unmarshal the object using the following, it works:

Unmarshaller u = new Unmarshaller(TestClass.class);
TestClass test = (TestClass) u.unmarshal(new StringReader(xml));


However, I need to use a mapping file. The entry for this class looks as
follows:

<class name="TestClass">
<field name="array" type="float" collection="array" direct="true"/>
</class>

Using this mapping file, the same xml is written out by the Marshaller.
No problems so far. However, when attempting to unmarshal the object
using the mapping, it fails:

Mapping mapping = new Mapping();
mapping.loadMapping( "mapping.xml" );

Unmarshaller u = new Unmarshaller(mapping);
TestClass test = (TestClass) u.unmarshal(new StringReader(xml));

throwing a NullPointerException in
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:
757)


This leads me to believe that Castor *can* successfully marshal and
unmarshal objects with 2D arrays, but either:
  a) not when a mapping file is specified
  b) not when the mapping file is wrong!

Hopefully it's b) and fixable? Or maybe even a c) ?

I don't have any other problems using mapping files, but for some reason
these 2D arrays are just not working.

Thanks


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

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

Reply via email to