commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@blueyonder.co.uk>
Subject Re: [validator] Schematron-type/XPath Validator
Date Fri, 21 May 2004 17:27:26 GMT
Given all the recent furore over collections is JXPath's dependency on it
due to Beanutils or does it use collections classes directly?

Also I was surprised JXPath depends on the servlet api and is this a
dependancy validator is OK to inherit?

http://jakarta.apache.org/commons/jxpath/dependencies.html

Niall

----- Original Message ----- 
From: "Don Brown" <mrdon@twdata.org>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Friday, May 21, 2004 5:41 PM
Subject: Re: [validator] Schematron-type/XPath Validator


> Yeah, I think putting it in contrib as Robert suggested might be a good
> start, however even if it shipped with Validator, it wouldn't be needed
> unless you wanted to use the jxpath validator. XPath is basically an
> expression language to locate nodes. While intended for XML documents,
> JXPath makes it possible to use it with JavaBeans, DynaBeans, and a
> bunch more. In addition to node location syntax, XPath includes various
> functions like the number() one in my example.
>
> A XPath tutorial:
> http://www.zvon.org/xxl/XPathTutorial/General/examples.html
> XPath functions:
>
http://www.devguru.com/Technologies/xslt/quickref/xslt_index_functions.html
>
> Of course this validator wouldn't be for everyone, particularly those
> with no XPath knowledge, but for those of us that work with it every
> day, it allows us to re-use that knowledge to do complex things quickly
> and efficiently. One less language/syntax to learn is a good thing! :)
>
> Don
>
> David Graham wrote:
>
> >This sounds interesting but I don't know anything about XPath so a more
in
> >depth example would be useful.  I'm also worried about adding another
> >dependency; maybe this could be an optional download?
> >
> >David
> >
> >--- Don Brown <mrdon@twdata.org> wrote:
> >
> >
> >>I wrote a simple Validator that uses JXPath to implement a
> >>schematron-style validation where fields are evaluated against boolean
> >>XPath expressions.  The idea is from the XMLForms project
> >>(http://www.xmlform.org), previously of Cocoon.  JXPath makes it easy to
> >>
> >>write complex validations on many types of objects that can span object
> >>trees.
> >>
> >>The initialization of the validator looks like this:
> >>
> >><validator name="jxpath"
> >>
> >>classname="org.apache.commons.validator.JXPathValidator"
> >>                 method="isValid"
> >>
> >>methodParams="java.lang.Object,org.apache.commons.validator.Field"
> >>                 msg=""/>
> >>
> >>and a sample usage:
> >>
> >><field property="value" depends="jxpath">
> >>  <var>
> >>    <var-name>test</var-name>
> >>    <var-value>number(.) > 0 and number(.) &lt; 10</var-value>
> >>  </var>
> >></field>
> >>
> >>The test variable contains the xpath expression to evaluate.  The
> >>"property" attribute contains the xpath expression to narrow the scope
> >>of the tested xpath.  Thanks to JXPath, this validator works on many
> >>different types of Java objects, including JavaBeans, and can handle
> >>field property xpath expressions that match multiple "nodes" or values.
> >>
> >>If this validator would be useful for the commons-validator project, I
> >>can supply code for the validator, unit tests, and any patches to
> >>existing files, through bugzilla of course.
> >>
> >>Don
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >>
> >>
> >>
> >
> >
> >
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >Yahoo! Domains – Claim yours for only $14.70/year
> >http://smallbusiness.promotions.yahoo.com/offer
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message