cocoon-dev mailing list archives

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

Not sure about that ;)

> Does the the SaxErrorHandler interface provide the XPath location of the
> 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:

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?)

> 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
> 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

> 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

> Cheers,
> Ivelin


To unsubscribe, e-mail:
For additional commands, email:

View raw message