In case you are using the code generation approach
I guess CASTOR by default validates the Object model. What it means is that it generates some validation code based on the xsd and when we try to load data into the objects it validates the data against the validation code generated. By default the validation by XML parser is switched off to avoid the overhead.You can enable it by modifying the castor.properties file
However the xsd support given by castor is not complete so if you are using code generation then CASTOR may not be the best choice. try XMLBeans or JAXB.
In case you are not using Code generation then you have to validate your XML against your XSD by using some parser and then pass it to castor only if it is validated successfully.
Hope it helps.
posted 15 years ago
I am not generating code from Castor. I am writing bean classes and mapping file myself.
I got your points to validate XML before it goes to Castor through some parser. What can be the simplest, efficient and easy way to validate XML against XSD. Please help me...
Thanks. [ August 01, 2005: Message edited by: rathi ji ]