Hi, 

I'd be grateful for some advice... 
As well as unmarshalling some XML, I'm trying to validate it - and 
the XML that I'm unmarshalling includes a schema reference. 
In my code I've done the following... 

Mapping mapping = new Mapping();  
InputSource is = new 
InputSource(mymessage.getClass().getResourceAsStream("mapping.xml"));  
mapping.loadMapping(is);  
 Unmarshaller unmar = new Unmarshaller(mapping);  
EntityResolver er = new MyHandler();  
unmar.setEntityResolver(er);  
unmar.setValidation(true);  
MyMessage msg = (MyMessage)unmar.unmarshal(new 
InputSource(mymessage.getClass().getResourceAsStream("test1.xml")));     


The entity resolver is needed to be able to look at a local copy of the schema 
that's referenced in the XML. 

As this code stands it doesn't seem to validate or call the entity resolver. 
If I turn on the org.exolab.castor.parser.validation property, then I get 
parsing errors when I unmarshall... 
Parsing Error : Document root element "Envelope", must match DOCTYPE root 
"null". 
Line : 2 
Column : 13 

org.xml.sax.SAXException: Parsing Error : Document root element "Envelope", 
must match DOCTYPE root "null". 
Line : 2 
Column : 13 


I'd really appreciate some pointers on this. 

Thanks, 
Joseph.


________________________________________________________________________
"The information in this email and any attached files is confidential. It is 
intended solely for the use of the addressee. Any unauthorised disclosure or 
use is prohibited. If you are not the intended recipient of the message, please 
notify the sender immediately and do not disclose the contents to any other 
person, use it for any purpose, or store or copy the information in any medium. 
The views of the author may not necessarily reflect those of the company.
The contents of an attachment to this e-mail may contain software viruses which 
could damage your own computer system. While Ultra Electronics Limited has 
taken every reasonable precaution to minimise this risk, we cannot accept 
liability for any damage which you sustain as a result of software viruses. You 
should carry out your own virus checks before opening the attachment."

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

Reply via email to