There are two different mechanisms for validation in OXF. The first one uses the schema-href or schema-uri attribute on the p:input or p:output element in any processor. OXF throws a ValidationException when the document doesn't match the schema.
The second mechanism validates XForms instances, and annotates the document with the v:error element when a validation exception is detected. This is typically used to validate user input in a webapp. This type of validation is activated with the schema attribute on the xforms:model element.
There is indeed a bug in the W3C Schema validation that "eats" the verbose error message. I attached a patch to OXF 2.0 that should correct this issue. Simply drop the Jar file in your WEB-INF/lib directory.
I couldn't reproduce the issue you have when switching schemas. Can you try again with OCF 2.0 and the patch?
Regards, Julien
Peter Charles wrote:
Thanks Julian, I got the same message using your code. In general I am more interested in validating against type than xml format. There was no example of using the xml-serializer to do validation in beta2.0b1 so I was going off the only example that does validation, the ca-traffic example. I created an xsd schema and then submitted string content to the field. The error that I got back was:
<v:error xmlns:v="http://orbeon.org/oxf/xml/validation" message="19"/>
using the relaxNG schema the info was a bit better:
<v:error xmlns:v="http://orbeon.org/oxf/xml/validation" message="Error bad character content for element near highway (schema: highway.rng)" system-id="oxf:/squote/xforms.xml" line="3" column="19"/>
Also I found that I could not switch between the higway.rng and highway.xsd (by changing the schema reference in the xform.xml file) with out starting and stopping tomcat, which doesn't seem right.
Here is highway.xsd <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="highway" type="xs:integer"> </xs:element> </xs:schema>
Couple of follow up questions:
In the ca-traffic example, it appears that validation is invoked by
including the xmlns:v in <p:choose href="#instance"
xmlns:v="http://orbeon.org/oxf/xml/validation"> With out this
declaration the form data is not validated.
This invocation of validation is very different than the example code you sent me, and very different than the suggested usage of the validation processor in the documentation /doc/processors-validation.
Can you explain how these different ways of invoking validation for me?
Also I would like to know why the error messages are so substantially
different between the ca-traffic example and your code.
I actually think that the ca-traffic example is more interesting and useful way of passing validation information, as the validation feed back can be fed back to the view. Is there a way to get the verbose error messages in the <v:error/> format?
Thanks
Peter
_______________________________________________ oxf-users mailing list [EMAIL PROTECTED] http://mail.orbeon.com/mailman/listinfo/oxf-users
00patch-w3cvalidation.jar
Description: application/java-archive_______________________________________________ oxf-users mailing list [EMAIL PROTECTED] http://mail.orbeon.com/mailman/listinfo/oxf-users
