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 <[EMAIL PROTECTED]> 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(.) < 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! Domains � Claim yours for only $14.70/year http://smallbusiness.promotions.yahoo.com/offer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
