I assume you have a inconsitency between the schema and the xml file. Please show them.
 
Heri
-----Original Message-----
From: janarthanankesavan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 03, 2004 3:22 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [castor-user] Validation exception while unmarshalling


Hi All,
While trying to unmarshall,
I get the validation exception:element " " occurs more than once.
Any help to solve this?
  <class name="com.test.Response">
<map-to xml="abc" />
  <field name="header" type="com.test.Header" >
  <bind-xml name="header"/> 
  </field>
  <field name="body" type="com.test.Body" >
  <bind-xml name="body"/> 
  </field>
  <field name="fault" type="com.test.Fault" >
  <bind-xml name="fault"/> 
  </field>
</class>


The class com.test.Response contains:

Header header;
Object body;
Fault fault;

and respective getters/setters.


My unmarshalling code:

FileReader in = new FileReader(fileObj);
fileObj contains mapping xml content.

abc = (Response) Unmarshaller.unmarshal(Response.class, in);


When i try to unmarshall, i get the following validation error:

ValidationException: element "class" occurs more than once. (parent class: com.test.Response)
location: /mapping/class
     at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:906)
     at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:1038)
     at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:569)
     at org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:646)
     at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:3003)
     at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:931)
     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java:1147)
     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:988)
     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1448)
     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
     at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:525)
     at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:581)
     at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
     at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1158)
     at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:605)
     at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:513)
     at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:691)

I am using castor 0.9.5.3.

Expecting your reply at the earliest and any help regarding this would be greatly appreciated.

Reg
Jana

Life is not a bed of roses!
----------------------------
With warmest regards,
T.K.Janarthanan.

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

Reply via email to