cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivelin Ivanov" <ive...@iname.com>
Subject Re: Cocoon Form binding and validation [was: RE: SchemoX forms]
Date Fri, 29 Mar 2002 18:51:40 GMT

Koshuke,

Thanks for the response.

I have released a Schematron validator implementation in Java as part as an
effort to improve form handling in Cocoon (xml.apache.org/cocoon)
The implementation behaves differently than you may expect, but the end
result should be compatible with the skeleton from Rick.

I'll forward the original announcement message in another email, so that you
can download the source.
It should be soon available on the Cocoon CVS repository.

My primary goal when working on the implementation was efficiency when
Schematron is used for validating JavaBeans and DOM nodes. The use cases
requiring validation which I was targeting were html forms, java domain
objects, persisted domain objects, web services binding and similar.

This is how it works roughly:

For a given phase, obtain the list of active patterns
If there is no phase specified, obtain all patterns
  For each active pattern
      For each rule in a pattern
          Obtain the set of elements in the source document which satisfy
the rule/@context attribute
               For each element in the set
                  For each assert and rerport for the rule
                       test the element against the @test attribute value
                          if test failed (in case of assert, not failed for
report)
                            add the failed assert to the ValidationResult

When a JavaBean or DOM node is validated, the result is a tree of patterns,
rules, asserts and reports which contains only the asserts and reports from
the original schema which were violated during validation. The context
element for the rules in the result set though contain the exact location of
the failed element.

This validation result format allows graceful error recovery and user
friendly diagnostics.

I understand that JARV is the skeleton which allows for multiple schemas to
be plugged in and is targeted more towards validation of automatic document
exchange. It doesn't seem to be readily applicable for user interface
validation.
I guess for simplicity reasons the SAXParseException was chosen for the
ErrorHandler interface, but it
only reports the document sys id, line and column number. For validation of
well formed documents like DOM and JavaBeans, an improved version could be
used to report the XPath element location. It doesn't seem like it'll cause
performance degradation for the validators in general .


Since user friendly diagnostics is critical if XML schemas are to be used
for a broader set of problems, do you have thoughts on how JARV should be
extended/wrapped with another layer which allows for ValidationResults
similar to the one mentioned above?

If you're interested, you may look at the recent discussion on the
Cocoon-dev list for a proposal submitted by Torsten Curdt for a generic
validation layer which can be adapted and wrapped around JARV.
http://www.mail-archive.com/cocoon-dev@xml.apache.org/msg13684.html


Looking forward to a productive outcome of our discussion.


Best regards,

Ivelin





----- Original Message -----
From: "Kohsuke Kawaguchi" <kk@kohsuke.org>
To: "Ivelin Ivanov" <ivelin@sbcglobal.net>
Cc: <schematron-love-in@lists.sourceforge.net>
Sent: Friday, March 29, 2002 12:09 PM
Subject: Re: Cocoon Form binding and validation [was: RE: SchemoX forms]


>
> > Can Scematron be fit within JARV without loss of features?
>
> I believe so. I'm not familiar with the status of Java schematron
> implementation, but if you give me a pointer to an open-source Java
> schematron validator, I'm happy to contribute a wrapper for JARV.
>
> regards,
> ----------------------
> Kohsuke Kawaguchi
> E-Mail: kk@kohsuke.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message