cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <ovi...@apache.org>
Subject Re: [VOTE] Schematron validator in Anteater (and Cocoon validating Transformer)
Date Wed, 12 Jun 2002 18:36:27 GMT
Ivelin,

I'm not Jeff, but I do have some ideas.

The Schematron validor would have a correspondent MatcherTest subclass in
Anteater. You would essentially need to implement the validate() method, in
which you call the Validator.validate() method. You either return true, if
Validator.validate() returns null, or you return false, and log the errors
using the inherited log() method.

Check out some of the matcher test classes in the
org/apache/anteater/test/matchers/ directory, like Parameter.java.

Regarding Junit reporting, I'd still like to understand a bit more what is
the idea behind this, and what would be the benefits of integrating with it.

Cheers,
Ovidiu

On 6/11/02 9:17 PM, "Ivelin Ivanov" <ivelin@apache.org> wrote:

> 
> Jeff,
> 
> The org.apache.cocoon.components.validation.Validator
> 
> interface has the following method:
> 
> List validate(Object instance)
> 
> It returns either null, when validation is successfull, or a list of
> Violation objects, each of which has an XPath address of the bad element
> and a String with the description of the problem.
> 
> How do you suggest I integrate this in Anteater?
> 
> Ideally I would like to integrate Anteater scripts with JUnit reports,
> so that the list of violations is listed in the place where unit test
> exceptions are repoported.
> 
> How is you progress with JUnit reports integration?
> 
> 
> BTW, JARV implements Relax NG validation.
> http://iso-relax.sourceforge.net/JARV/
> 
> 
> Ivelin
> 
> 
> 
> 
> 
> 
> Jeff Turner wrote:
>> Hi Ivelin,
>> 
>> On Fri, Jun 07, 2002 at 06:51:09PM -0500, Ivelin Ivanov wrote:
>> ...
>> 
>>> The ideas is to use references to schema documents of standard XML languages
>>> (like Schematron, DTD, XML Schema, Relax NG) for response validation,
>>> instead of supporting a proprietary grammar.
>> 
>> 
>> Adding a Schematron validator would be great. It would be a superset of
>> functionality provided by our existing <xpath> validator. I'd also like
>> to add a Relax NG validator at some stage.
>> 
>> 
>>> I suggest that we use the org.apache.cocoon.components.validation package
>>> which is an independent component in Cocoon's main tree and is used by
>>> XMLForm.
>>> 
>>> The Schematron implementation is already available and I think it is quite
>>> suitable for Anteater, because Schematron is a superset of Anteater's match
>>> element.
>>> To be precise it is a superset of the validating use, i.e the cases when
>>> match is used to assign value to a "result" property. Asigning values within
>>> <match/> to other properties which are used for subsequent requests is
a
>>> separate concern.
>> 
>> 
>> So..
>> 
>> Latka has it's Validator interface, consisting of:
>> 
>> public abstract void validate(Response response) throws ValidationException;
>>      // throw an exception on validation failure
>> 
>> Anteater has a MatcherTest abstract class:
>> 
>>   public void setObjectModel(HashMap objectModel);
>>   public abstract boolean validate() throws BuildException;
>>   public boolean getResult();
>> 
>> And Cocoon has another Validator interface:
>> 
>>   public abstract void validate(Response response) throws
>> ValidationException;
>>   public void setProperty(java.lang.String property, java.lang.Object value);
>>   public java.lang.Object getProperty(java.lang.String property);
>> 
>> Here are the validators currently available:
>> 
>> ByteLengthValidator (Latka)
>> CookieValidator (Latka, Anteater)
>> ContentEquals (compare contents vs. file) (Latka, Anteater)
>> MaxRequestTimeValidator (Latka)
>> RegexpValidator (Latka, Anteater, Webtest)
>> StatusCodeValidator (Latka, Anteater)
>> XPathValidator (Latka, Anteater)
>> SchematronValidator (Cocoon)
>> 
>> It would be good if we could come up with a common API that everyone
>> could implement. Eg, adopt Latka or Cocoon's Request/Response
>> abstraction, plus Anteater/Cocoon's ability to pass an 'object model'
>> (aka Avalon Context). Plus I'd like some way to record what's been done,
>> for later reporting.
>> 
>> But anyway, that's for down the road. There are few enough validators
>> currently that it's less effort just to modify the code for each testing
>> framework.
>> 
>> 
>> <snip schematron goodness/>
>> 
>> Schematron looks very cool. Another even easier-to-use possibility would
>> be Examplotron (http://examplotron.org/).
>> 
>> <rant>
>> We live in dark days where the majority of Apache is unthinkingly
>> adopting XML Schema, despite it's inferiority, simply because it's from
>> the W3C. Kimbro Staken said it best:
>> http://radio.weblogs.com/0100213/2002/06/06.html#a392
>> </rant>
>> 
>>> The violations can be then nicely integrated in the JUnit reporting
>>> package.
>> 
>> 
>> I have JUnit formatting integration minimally working here, will clean
>> up, check in and announce it tomorrow probably.
>> 
>> 
>>> If there are enough votes I'll contribute some of the work myself.
>>> Help would be certainly appreciated.
>> 
>> 
>> +1 :)
>> 
>> If any Cocoon developers are interested, and want to help or just lurk,
>> the relevant list to join is:
>> 
>> http://lists.sourceforge.net/lists/listinfo/aft-devel
>> 
>> And the project page is:
>> 
>> http://www.sourceforge.net/projects/aft/
>> 
>> 
>> --Jeff
>> 
>> 
>>> -= Ivelin =-


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


Mime
View raw message