Hello List

I have a mapping file that maps some java types to xml nodes (using map-to)
I have set 

org.exolab.castor.xml.strictelements=true
in castor.properties

and the following code in Unmarshalling code..
Where reqClz is the expected class as defined in mapping file.

Unmarshaller unmarshaller = new Unmarshaller(reqClz);
unmarshaller.setMapping(mapping);
unmarshaller.setValidation(true);
unmarshaller.setWhitespacePreserve(true);
unmarshaller.setIgnoreExtraElements(false);
Object req = unmarshaller.unmarshal(new StringReader(request));

The xml "<Request>....</Request>" is the map to that class.
However if I feed the Unmarshaller with the following 
Xml "<IDoNotKnowThisStruct></IDoNotKnowThisStruct>"

I was expecting an SAXException because of strictelements property, 
but I am not getting. I am getting instead, an instance of reqClz with
default values only.

Again, however, if do feed
"<Request><IDoNotKnowThisStruct></IDoNotKnowThisStruct>....</Request>"
I have an exception, as expected..

What am I doing wrong ??

TIA
Diogo

-----------------------------------
Diogo Bacelar Quintela
EF - Tecnologias de Informa��o, Lda.
Av. Ant�nio Serpa, 26 - 4� Dto.
1050-027 Lisboa, Portugal
Tel: (+351) 217 827 800
Fax: (+351) 217 827 830
Email: [EMAIL PROTECTED]
PGP: 0xF51A5AB9 


Reply via email to