Java Mailing List Archive

http://www.junlu.com/

Home » user.castor »

[castor-user] Marshalling Validation - castor 1.3: Not erroring for
undefined element

Asmita_tel

2009-09-22

Replies: Find Java Web Hosting

Author LoginPost Reply

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

--
Sent from the Castor - User mailing list archive at Nabble.com.


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

  http://xircles.codehaus.org/manage_email


©2008 junlu.com - Jax Systems, LLC, U.S.A.