Andrew, looks like you have indeed come across a problem with handling of 'boolean values'. Can I please ask you to raise a new Jira issue at
http://jira.codehaus.org/browse/CASTOR and we'll be dealing with it through this ticket. Thanks Werner Andrew wrote: > I'm trying to use castor 1.3 as the validator of incoming xml > documents. This is a basic XML schema contains only built-in types: > <?xml version="1.0"?> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:basic="http://www.example.com/test" > targetNamespace="http://www.example.com/test"> > > <xs:element name = "BuiltinElement" type="basic:BuiltinTypes"/> > <xs:complexType name="BuiltinTypes"> > <xs:sequence> > <xs:element name="StringElement" type="xs:string" /> > <xs:element name="IntegerElement" type="xs:integer"/> > <xs:element name="BooleanElement" type="xs:boolean"/> > </xs:sequence> > </xs:complexType> > </xs:schema> > > After generate java and descriptor classes, I try to validation some > xml instances in ValidateTest.java. Parser validation is disabled by > default. This is my validation related configurations in > castor.properties: > org.exolab.castor.parser.validation=false > org.exolab.castor.parser.namespaces=false > org.exolab.castor.marshalling.validation=true > > ValidateTest.java: > public static void main( String[] args ) { > String filename = args[0]; > try { > > BuiltinTypes builtin01 = > BuiltinTypes.unmarshalBuiltinTypes(new FileReader(filename)); > StringWriter myWriter = new StringWriter(); > Marshaller m1 = new Marshaller( myWriter ); > m1.marshal(builtin01); > System.out.println( "Castor Output:" ); > System.out.println( myWriter.getBuffer().toString() ); > System.out.println( "" ); > } > catch( Exception e ) { > e.printStackTrace(); > } > } > } > > Castor validation works fine with string and integer types, while once > I input the following instance with invalid boolean type, castor > doesn't raise any validation exception but treat wrong input as false: > <?xml version="1.0"?> > <BuiltinElement> > <StringElement>abc</StringElement> > <IntegerElement>111</IntegerElement> > <BooleanElement>whatever</BooleanElement> > </BuiltinElement> > > Castor Output: > <?xml version="1.0" encoding="UTF-8"?> > <BuiltinTypes xmlns="http://www.example.com/test"> > <StringElement>abc</StringElement> > <IntegerElement>111</IntegerElement> > <BooleanElement>false</BooleanElement> > </BuiltinTypes> > > It seems castor in-object validation doesn't validate boolean type > well in this case. Is there anything wrong with my code or > configurations? > > Thanks, > Andrew > > --------------------------------------------------------------------- > 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

