cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mats Norén <m...@alma.nu>
Subject Re: Cocoon Form binding and validation [was: RE: SchemoX forms]
Date Thu, 28 Mar 2002 11:16:01 GMT
> I've submitted a few questions on the JARV message board, but maybe you
can
> answer quicker.

Not sure about that ;)

>
> Does the the SaxErrorHandler interface provide the XPath location of the
bad
> elelement, or it can only report the
> file, line and column where the failure occured.

The SaxErrorHandler can, to the best of my knowledge, NOT provide you with
the XPath location of the bad element,
a quick workaround is to implement a tag tracking Stack in the errorhandler.
I build the XPath-expression when the events flow in and when an error occur
in an element I peek at the stack and use that as the location.
In an conversation with Kohsuke Kawaguchi, the developer, he proposed the
following solution:

<paste>
Umm, I'm not sure if I want to add such a specialized capability into
the generic verifier implementation.

It seems like the same goal can be achieved by using a SAX XMLFilter.
Let's say there is an XMLFilter that tracks XPath. You can set up the
pipeline as follows

parser --> XPathTracker --> VerifierFilter --> YourHandler

XPathTracker and VerifierFilter don't know anything about each other.
XPathTracker will update XPath information before it passes an event to
the next handler (in this case that's VerifierFilter.)

Once an error is reported by VerifierFilter, the error handler can ask
XPathTracker about the current XPath, it can then process
ValidityViolation with XPath.

XPathTracker only need to track element-level XPath. I can update MSV to
report more information about attributes (i.e., which attribute went
wrong? was it because of the bad value, or the attribute is undeclared?)
</paste>

> Also, how would you use JARV to implement partial document validation?
> For example if you want to validate the user/car-info/model element, but
not
> necessary the whole user element.

With MSV you can verify a single DOM Node and not the entire document.
verifier.verify(Node node) should work as well as verifier.verify(Element
element)

>
> BTW, what exactly is the MSV license. It seemed like its was open source,
> but it wasn't very clear to me. Is it compatible with Apache's?

Not sure about that. The best thing to do is to ask the developer Kohsuke
Kawaguchi.
kohsuke.kawaguchi@sun.com

>
> Cheers,
>
> Ivelin
Regards,

Mats


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


Mime
View raw message