|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Marshalling Validation - castor 1.3: Not erroring for undefined elementHi,
I am using castor 1.3 and I am just using the marshalling validation for the given xml. I have the xsd from which I generated classes using casto 1.3. Now when the system receives the xml, it goes through marshalling validation in which: -It validates the mandatory missing fields -It validates the data type of the elements so it adheres to the definition given xsd for eg: String length, alpha numeric format - etc However there is one thing that it is failing to validate is: If there is any node/element which does not match with the ones given in xsd: it simply ignores the undefined element(s) and processes the rest of xml without spitting out the error. The way it should be is it should error out complaining about the undefined element. There is no generated class for the given node - when doing the marshalling validation. How can I change the castor.properties so it would error when it comes across undefined element during the marshalling process. I hoped this property in castor.properties would work: But changing it to 'false' has no change. org.exolab.castor.xml.lenient.introspected.element.strictness=true Here are the other significant properties set in my castor.properties # True if xml documents should be validated by the SAX Parser # Defaults to false. # org.exolab.castor.parser.validation=false # True for parser to support Namespaces. # Defaults to false. # #org.exolab.castor.parser.namespaces=false # True if all documents should be validated by the marshaling framework # Defaults to true. # org.exolab.castor.marshalling.validation=true org.exolab.castor.indent=true # An implementation which uses the Jakarta RegExp library: org.exolab.castor.regexp=org.exolab.castor.util.JakartaRegExpEvaluator # # An implementation which uses the Jakarta ORO library: #org.exolab.castor.regexp=org.exolab.castor.util.JakartaOroEvaluator |
|
|
Re: Marshalling Validation - castor 1.3: Not erroring for undefined elementHi,
have a look at http://castor.org/javadoc/org/exolab/castor/xml/Unmarshaller.html#setIgnoreExtraElements(boolean) which should be what you are looking for. Werner PS And yes, these setters are not properly documented in the reference guide .. :-(. Asmita_tel wrote: > Hi, > > I am using castor 1.3 and I am just using the marshalling validation for the > given xml. > I have the xsd from which I generated classes using casto 1.3. Now when the > system receives the xml, it goes through marshalling validation in which: > -It validates the mandatory missing fields > -It validates the data type of the elements so it adheres to the definition > given xsd for eg: String length, alpha numeric format - etc > > However there is one thing that it is failing to validate is: > If there is any node/element which does not match with the ones given in > xsd: it simply ignores the undefined element(s) and processes the rest of > xml without spitting out the error. The way it should be is it should error > out complaining about the undefined element. There is no generated class for > the given node - when doing the marshalling validation. > > How can I change the castor.properties so it would error when it comes > across undefined element during the marshalling process. > > I hoped this property in castor.properties would work: > But changing it to 'false' has no change. > > org.exolab.castor.xml.lenient.introspected.element.strictness=true > > Here are the other significant properties set in my castor.properties > > # True if xml documents should be validated by the SAX Parser > # Defaults to false. > # > org.exolab.castor.parser.validation=false > > # True for parser to support Namespaces. > # Defaults to false. > # > #org.exolab.castor.parser.namespaces=false > > # True if all documents should be validated by the marshaling framework > # Defaults to true. > # > org.exolab.castor.marshalling.validation=true > > org.exolab.castor.indent=true > > # An implementation which uses the Jakarta RegExp library: > org.exolab.castor.regexp=org.exolab.castor.util.JakartaRegExpEvaluator > # > # An implementation which uses the Jakarta ORO library: > #org.exolab.castor.regexp=org.exolab.castor.util.JakartaOroEvaluator > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |