Hi,
 
I am using Castor Source generator for a XSD which has an entry as follows:
 
<xs:element name="device_name" nillable = "false" type="xs:string" />
 
I wanted to ensure that the the entry device_name is not "empty", or not "white space characters". so i introduced this "nillable = false" after googling. However the code for checking null is not generated by Castor. So i added the code as below for validation? Will castor not generate such checks? or am i doing sth wrong here?
 
Kindly help me out.
 

However, the code generated for validation, is as follows: 

fieldValidator.setMinOccurs(1);
        { //-- local scope
            StringValidator typeValidator = new StringValidator();
            typeValidator.setWhiteSpace("preserve");
            //added by me
            typeValidator.setMinLength(1);
           
            fieldValidator.setValidator(typeValidator);
        }
        desc.setValidator(fieldValidator);

Cheers

Vinodh

 

Reply via email to