Did you try to add: <bind-xml name="item"/>

as in:

<field name="items" type="test.Item" collection="vector">
   <bind-xml name="item"/>
</field>

You can also try adding a map-to element in the class descriptor for
Item:

<class name="test.Item">
 <map-to xml="item"/>
  ...
 
</class>


--Keith


BinhMinh Nguyen wrote:
> 
> Hi,
> I have a very strange error, tried to sovled but I
> dont know how, please help.
> 
> I have downloaded the ssample from the Wrox chapter
> 15, the chapter about XML binding using Castor. When I
> just compile and run the InvoiceDisplay , everything
> seems to run very well, but then when I modified ONLY
> the package structure, is, I put all the class into a
> package structure "test", compilation went OK but when
> run, I got the below error. That is the only
> modification I made...just want to make it look
> cleaner ... and of course I did modified the mapping
> file and the path to look for these input
> files...please help me spot out the error, I spent
> many hours, but can figure out why...
> 
> the mapping file:
> -----------------------------------------------
> <?xml version="1.0"?>
> <mapping>
> 
>   <description>Mapping example for the Item
> class</description>
> 
>   <class name="test.Invoice">
>      <field name="items" type="test.Item"
> collection="vector"/>
>      <field name="total" type="double"
> get-method="getTotal">
>          <bind-xml name="total-price"/>
>      </field>
>   </class>
> 
>   <class name="test.Item">
> 
>      <field name="productSku" type="string">
>         <bind-xml name="sku" node="attribute"/>
>      </field>
>      <field name="description" type="string"/>
>      <field name="name"        type="string"/>
>      <field name="price"       type="double"/>
>      <field name="quantity"    type="integer"/>
> 
>   </class>
> </mapping>
> 
> 
> Error Message:
> -----------------------------------------------
> org.xml.sax.SAXException: unable to find
> FieldDescriptor for 'item' in ClassDescriptor of
> test.Invoice
>         at
> org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:713)
>         at
> org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1340)
>         at
> 
>org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:965)
>         at
> 
>org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1858)
>         at
> 
>org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1234)
>         at
> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
>         at
> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:952)
>         at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:335)
>         at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:267)
>         at test.InvoiceDisplay.main(InvoiceDisplay.java:36)
> 
> __________________________________________________
> Do You Yahoo!?
> Make a great connection at Yahoo! Personals.
> http://personals.yahoo.com
> 
> -----------------------------------------------------------
> 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