Hi Andy,
If you want to do XML Schema validation during unmarshalling when using
a mapping file for the binding, you need to enable parser validation in
the castor.properties.
org.exolab.castor.parser.validation=true
By default it's disabled.
This will allow Xerces (or whatever parser you're using) to handle the
validation and Castor will simply handle the XML binding.
You may also want to disable Castor's validators in this case, since
they really don't provide much use when used in conjunction with a
mapping file:
org.exolab.castor.marshalling.validation=false
--Keith
Andy Shearman wrote:
>
> Hi Group,
>
> I have a bean like object and a mapping file so that incoming xml docs can be
> unmarshalled into a java object.
>
> Setting the mapping file is ok but my question relates to guarenteeing the
> "well-formedness" of the incoming xml.
>
> When unmarshalling will the unmarhaller validate the incoming xml against an xsd
> before doing the introspection on the java object? That is to say if I specify an
> xsi:schemaLocation tag in the root node will validation occur (I am trying to do
> this now but seem to be failing in that "anything goes")..
>
> Obviously, the reason is I'd like to publish an xsd for people to create well formed
> object that I'll intepret.
>
> I have set the "setValidation" to true...
>
> cheers one and all...
>
> Andy Shearman
>
> ------------------------------------------------------------------------
> -----------------------------------------------------------
> 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