Hi,

I am quite new to Castor and need help on this.

I am using the Unmarshalling feature of Castor. That
is I want to read the XML file and populate my bean
object with the XML data.
I have an XML file as a String that looks like:

<?xml version="1.0" encoding="UTF-8"?>
<order>
   <report-id>Swati</report-id>
   <ShopId>55</ShopId>   
</order>

My mapping file is loaded well and even the
Unmarshaller is initialized.
However, when I unmarshall it by saying:

order = (Order)unmar.unmarshal(new InputSource(new
StringReader(uploadedXML)));

I get an error saying that:

org.xml.sax.SAXException: The class for the root
element 'order' could not be found.
        at
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1542)
        at
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1375)
        at
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
        at
org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at
org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown
Source)
        at
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:693)

Please help!

Thanks,
Swati

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to