http://www.castor.org/how-to-enable-xml-validation.html should provide you with 
answers to your question.

Werner

> -----Ursprüngliche Nachricht-----
> Von: S. Sharif [mailto:[EMAIL PROTECTED]
> Gesendet: Dienstag, 13. März 2007 02:23
> An: [email protected]
> Betreff: [castor-user] How to do XSD validation when the code was not
> generated by the Castor code generator
> 
> 
> Hi,
> 
> I am not using the Castor code generator to generate
> my Java classes.  Instead I have my own java classes
> that I am marshalling and unmarshalling to/from them
> using a Castor mapping file.
> 
> But now I am faced with the problem of how to perform
> the XSD validation.  I know that the Castor code
> generator generates each Java class with the following
> code:
> 
> /**
>  *
>  *
>  * @throws org.exolab.castor.xml.ValidationException
> if this
>  * object is an invalid instance according to the
> schema
>  */
> public void validate()
> throws org.exolab.castor.xml.ValidationException {
>     org.exolab.castor.xml.Validator validator = new
> org.exolab.castor.xml.Validator();
>     validator.validate(this);
> }
> 
> 
> and that this code performs the XSD validation on the
> Java object using the ClassDescriptors and
> FieldDescriptors that were generated for that object.
> 
> But now how do I perform XSD validation when I have my
> own Java classes (that were not generated by Castor).
> Is there some Castor API that I can call and pass to
> it the path to the XSD file, the Java object that I
> want to validate, and also the Castor mapping file,
> and then it performs the validation?
> Or how should I go about doing this?
> 
> Thanks.
> 
> -Saladin
> 
> 
> **********************************************************
> * Saladin Sharif
> * e-mail:  [EMAIL PROTECTED]
> * Visit homepage @ http://gaia.ecs.csus.edu/~sharifs
> **********************************************************
> 
> 
> 
> __________________________________________________________________________
> __________
> Don't pick lemons.
> See all the new 2007 cars at Yahoo! Autos.
> http://autos.yahoo.com/new_cars.html
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to