Hello All,

Please help me with mapping issue.
I want to transfer the following elements

 <DataOne_Multiple_Style_Name>
        <item>x</item> 
        <item>y</item> 
  </DataOne_Multiple_Style_Name>

  <DataOne_Multiple_Style>
       <item>z</item>
       <item>w</item>
 </DataOne_Multiple_Style>
 
to 2 lists , containing strings.

private List m_listMultipleStyleNames; // <-- must contain "x" and "y"
private List m_listMultipleStyles; // <-- must contain "z" and "w"


I tried to do the following in my mapping file:

<field name="DataOneMultipleStyleNames" collection="arraylist"
type="java.lang.String">
                        <bind-xml name="item" node="element"
location="DataOne_Multiple_Style_Name" />  
</field>

<field name="DataOneMultipleStyles" collection="arraylist" type="java.lang.String">
                        <bind-xml name="item" node="element"
location="DataOne_Multiple_Style" />       
</field>

I have corresponding getXXX and setXXX methods in my class.

but this doesnot work, i am getting the following exception:

org.xml.sax.SAXException: unable to add 'item' to <harness_REST_service> due to the
following exception:
java.lang.IllegalArgumentException: object is not an instance of declaring class
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.exolab.castor.mapping.loader.FieldHandlerImpl.setValue(FieldHandlerImpl.java:530)
        at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:970)
        at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:1038)
        at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
        at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1436)
        at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1205)
        at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035)
        at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:605)
        at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:513)
        at CastorTest.testMapping(CastorTest.java:27)
        at CastorTest.main(CastorTest.java:14)

Any help appreciated
Regards,
Dima



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

Reply via email to