Matt,
Did you try adding collection="array" to your mapping?
--Keith
Emerson, Matt wrote:
I have created two classes: Product and SubProduct. The product is designed to hold a two-dimensional array of SubProducts.
Public class Product
{ private SubProduct[][] array;
public Product()
public List setArray(SubProduct[][] data) { this.array = data; }
public SubProduct[][] getArray() { return this.array; } }
Public class SubProduct { private String name; private String value;
public void setName(String data) { this.name = data; } publci void sety Value(String data) { this.value = data; } }
My mapping is as follows:
<mapping>
<description>Description of the mapping for the Product Class</description>
<class name="com.fmr.cfit.matt.castor.Product">
<map-to xml="WrapperProductClass"></map-to> <field name="array" type="com.fmr.cfit.matt.castor.SubProduct">
<bind-xml name="row" location="data_array"/> </field> </class>
<class name="com.fmr.cfit.matt.castor.SubProduct">
<map-to xml="sub_product"></map-to>
<field name="name" type="java.lang.String">
<bind-xml name="name" node="attribute"/>
</field>
<field name="value" type="java.lang.String">
<bind-xml name="value" node="element"/>
</field>
</class>
</mapping>
When I marshal, a class of type Product, everything works fine.
However, when I try to unmarshall the results back into an object, I get the following error. Does anyone know why this would be occurring?
#startElement: data_array
wrapper-element: data_array
#startElement: row
unable to find or create a ClassDescriptor for class: [Lcom.fmr.cfit.matt.castor.SubProduct;
unable to instantiate [Lcom.fmr.cfit.matt.castor.SubProduct;; org.xml.sax.SAXException: [Lcom.fmr.cfit.matt.castor.SubProduct; is not a subclass of com.fmr.cfit.matt.castor.SubProduct
org.xml.sax.SAXException: unable to instantiate [Lcom.fmr.cfit.matt.castor.SubProduct;; org.xml.sax.SAXException: [Lcom.fmr.cfit.matt.castor.SubProduct; is not a subclass of com.fmr.cfit.matt.castor.SubProduct
void org.exolab.castor.xml.UnmarshalHandler.startElement(java.lang.String, java.lang.String, org.exolab.castor.xml.AttributeSet)
UnmarshalHandler.java:1959
void org.exolab.castor.xml.UnmarshalHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
UnmarshalHandler.java:1292
void org.apache.xerces.parsers.SAXParser.startElement(org.apache.xerces.utils.QName, org.apache.xerces.framework.XMLAttrList, int)
SAXParser.java:1371
void org.apache.xerces.validators.common.XMLValidator.callStartElement(org.apache.xerces.utils.QName)
XMLValidator.java:840
boolean org.apache.xerces.framework.XMLDocumentScanner.scanElement(org.apache.xerces.utils.QName)
XMLDocumentScanner.java:1852
boolean org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(boolean)
XMLDocumentScanner.java:1233
boolean org.apache.xerces.framework.XMLDocumentScanner.parseSome(boolean)
XMLDocumentScanner.java:380
void org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource)
XMLParser.java:908
java.lang.Object org.exolab.castor.xml.Unmarshaller.unmarshal(org.xml.sax.InputSource) Unmarshaller.java:605
java.lang.Object org.exolab.castor.xml.Unmarshaller.unmarshal(java.io.Reader) Unmarshaller.java:513
void com.fmr.cfit.matt.castor.TestCastor.runTest2()
TestCastor.java:77
void com.fmr.cfit.matt.castor.TestCastor.main(java.lang.String[])
TestCastor.java:36
Thanks for the help,
Matt
------------------------------------------------------------------------
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
