But.. how to pass the XML schema to the validator ?

---- Subodh

-----Original Message-----
From: Ostermueller, Erik [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 07, 2004 7:18 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Data validation using schema



Look in the castor.properties file.

# True if all documents should be validated by the marshalling framework
# org.exolab.castor.marshalling.validation=true


...so when you invoke marshal() or unmarshal() on a generated value
object, castor will throw validation exceptions where necessary.


I'm not sure why this next property is helpful, but it is important to 
understand it:

# True if xml documents should be validated by the SAX Parser
#
org.exolab.castor.parser.validation=false


The first property invokes castor-generated java the performs the same
validation as the schema. The second property invokes the parser's
validator.


If you want to kick off the validation manually, invoke this:

        org.exolab.castor.xml.Validator validator = new
org.exolab.castor.xml.Validator();
        validator.validate(myGeneratedValueObject);

Hope that helps,

--Erik

-----Original Message-----
From: Subodh Damle [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 07, 2004 3:46 AM
To: [EMAIL PROTECTED]
Subject: [castor-dev] Data validation using schema




I know that Castor provides means to validate data against a XML schema,
yet I am not yet able to figure out just how.

Can anyone please briefly list out the main steps required for a task as
described below : 


The problem :

There are order types A, B... 
Corresponding XML schema are A.xsd, B.xsd .. 

Depending on some ext parameter, we have to  :
 1. Instantiate correct order type : new A() / new B()
 2. Take correct schema : A.xsd / B.xsd

 Now, we have to validate the marshaled object (from 1) against the
schema (from 2)

 i.e. 
        obj = new A() / new B() // <-- depending on external parameter
        schema = A.xsd / B.xsd  // <-- depending on external parameter

        validate ( obj, schema ); // <====== how do I do this 



Thanks,
S





*********************************************************
Disclaimer:          

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com

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

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


*********************************************************
Disclaimer:          

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com

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

Reply via email to