Can you please set the mapping on the Unmarshaller instance using
Unmarshaller.setMapping()
rather than passing it to the constructor.
Regards
Werner
S. Sharif wrote:
> Hi,
> I get the following error
>
> unable to find FieldDescriptor for
> 'DVPCRITERIAINPUT_LIST' in ClassDescriptor of
> Document{File: [not available]; line: 3 column: 26}
> at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:740)
> at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:596)
> ..... etc.
>
>
> when I execute the following piece of code:
>
>
> // load castor mapping file
> Mapping map = new Mapping();
> map.loadMapping(mappingPath);
> unmarshaller = new Unmarshaller(map);
>
> // Unmarshall the input xml into a value object
> RunDvpRequestVO runDvpRequest = (RunDvpRequestVO)
> unmarshaller.unmarshal(new
> FileReader(inputXmlFilePath));
>
>
>
> with the following input xml:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Document>
> <DVPCRITERIAINPUT_LIST>
> <DVPCRITERIAINPUT>
> <DVPCRITERIAID>1</DVPCRITERIAID>
> </DVPCRITERIAINPUT>
> </DVPCRITERIAINPUT_LIST>
>
> [ ... remaining xml was omitted for brevity ...]
>
> </Document>
>
>
>
> This is the Castor xml mapping file that I used:
>
>
> <mapping>
> <description>Description of the
> mapping</description>
>
> <!-- ----- ----- 1st Group of Classes ----- -----
> -->
>
> <class
> name="com.testcom.nget.valueobject.databinding.response.RunDvpResponseVO"
> auto-complete="true">
> <map-to xml="Document"/>
> <field name="response"
> type="com.testcom.nget.valueobject.databinding.response.ResponseVO">
> <bind-xml name="RESPONSE"
> location="RESPONSE_LIST"/>
> </field>
> <field name="dvpRunId">
> <bind-xml name="DVPRUNID"
> location="DVPRUN_LIST/DVPRUN"/>
> </field>
> </class>
>
>
> [ ... more xml was omitted for brevity ...]
>
>
> <!-- ----- ----- 2nd Group of Classes ----- -----
> -->
>
> <class
> name="com.testcom.nget.valueobject.databinding.RunDvpRequest.RunDvpRequestVO"
> auto-complete="true">
> <map-to xml="Document"/>
> <field name="logins" collection="hashtable" >
> <bind-xml name="LOGIN_LIST">
> <class
> name="org.exolab.castor.mapping.MapItem">
> <field name="key" type="java.lang.String">
> <bind-xml name="filter" node="attribute"/>
> </field>
> <field name="value"
> type="com.testcom.nget.valueobject.databinding.RunDvpRequest.LoginVO">
> <bind-xml name="LOGIN"/>
> </field>
> </class>
> </bind-xml>
> </field>
> <field name="dvpCriteriaId">
> <bind-xml name="DVPCRITERIAID"
> location="DVPCRITERIAINPUT_LIST/DVPCRITERIAINPUT"/>
> </field>
> </class>
>
> [ ... more xml was omitted for brevity ...]
>
>
> </mapping>
>
>
>
> What is strange is that when I reorder the classes in
> the xml mapping file, by moving the 1st group of
> classes below the 2nd group of class in the mapping
> file above, the error goes away. Is there a way for
> me to avoid getting this error programmatically rather
> than having to re-order the mapping file?
>
> I am still in the process of adding more classes to
> the same mapping file, and I am concerned that as the
> mapping file grows big, at some point I may no longer
> be able to reorder the mapping file in the right
> order, in order for the code to work.
>
> Any help or suggestions is very much appreciated.
>
> Thanks.
>
>
> **********************************************************
> * Saladin Sharif
> * e-mail: [EMAIL PROTECTED]
> * Visit homepage @ http://gaia.ecs.csus.edu/~sharifs
> **********************************************************
>
>
>
> ____________________________________________________________________________________
> The fish are biting.
> Get more visitors on your site using Yahoo! Search Marketing.
> http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
> http://xircles.codehaus.org/manage_email
>
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email