Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 95589 invoked from network); 1 Sep 2003 20:04:36 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 1 Sep 2003 20:04:36 -0000 Received: (qmail 50331 invoked by uid 500); 1 Sep 2003 20:04:17 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 50177 invoked by uid 500); 1 Sep 2003 20:04:16 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 50155 invoked from network); 1 Sep 2003 20:04:15 -0000 Received: from unknown (HELO smtp1.xs4all.be) (195.144.64.135) by daedalus.apache.org with SMTP; 1 Sep 2003 20:04:15 -0000 Received: from outerthought.org (195-144-088-026.dyn.adsl.xs4all.be [195.144.88.26]) (authenticated bits=0) by smtp1.xs4all.be (8.12.9/8.12.9) with ESMTP id h81K4FWB005144 for ; Mon, 1 Sep 2003 22:04:15 +0200 Message-ID: <3F53A63D.80103@outerthought.org> Date: Mon, 01 Sep 2003 22:04:13 +0200 From: Marc Portier Organization: Outerthought User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030723 Thunderbird/0.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: Lenient Woody Binding References: <3F530D3E.609@outerthought.org> <3F536E7C.8060306@anyware-tech.com> In-Reply-To: <3F536E7C.8060306@anyware-tech.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Sylvain Wallez wrote: > Marc Portier wrote: > >> Hi all, >> >> >> Woody binding currently breaks if the xpath's to bind to don't exist >> in the XML (or JavaBean) >> This 'breaking' is manifesting itself through a JXPathException >> (org.apache.commons.jxpath.*) being thrown. >> The JXpath API offers a 'lenient' setting to change this behaviour >> into just returning a 'null' (see jxpath javadoc at [1]) >> >> The danger in just using that last option is that (e.g for the >> ContextBinding) the current exception would be covered up but instead >> lead to a NPE further down the processing (which would arguably be >> harder to debug/spot) >> >> Furthermore, I can see environments were people would rather be >> confronted with the failing XML and see the exception, so I guess it >> needs to end up as a binding-config file setting. (probably an >> @lenient on each component that has some kind of @path in its config) >> >> In order for Binding to gracefully survive (in a best effort manner) >> the various binding components should thus know their own 'lenient' >> mode, check for null returns and stop any nested child bindings if a >> null was returned. >> >> The lenient member of each binding component should allow for 3 states: >> - null (not set): meaning take it as it comes from the parent binding, >> - true or false : meaning change the jxpath context lenient mode >> further down. >> >> I plan to make the changes in code and docos on this today. >> Any comments welcome. > > > > Lenient mode is definitely required since non-required widgets are > likely to be bound to optional elements (considering the application > model is an XML doc). And these elements may not exist in the XML > document, but should be added as a result of form validation. > yep, makes sense all the way > I would even say that lenient mode should be the default. > still doubting here: kind of depends from which angle you look at this, no? I'ld have to admit that from a lazy developer viewpoint I would rather take the same default as jxpath itself is taking (lenient==false) And also from a concrete usage viewpoint it feels a bit 'safer' to let people explicitely mark that they know what they are doing, and should be trusted in explicitely requesting lenient mode? Finally, the lenient stuff will only go so far in so called 'default' mode: in the roundtrip case of saveFormToModel the value-binding in lenient mode is likely to require some template node structure to be created/inserted, no? (like row-binding on repeaters) Given the kind of explicit typing this is going to require, I think the explicit marking @lenient=true that you are going to add it isn't unnatural? Did this at least introduce some doubth at your side ;-) ? Anyway, my priority list got switched somewhat, so it didn't happen today, but should somewhere this (or early next) week ... giving us some more time to think and talk about it and reach consensus on the expected behaviour... > Sylvain > -marc= -- Marc Portier http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center Read my weblog at http://radio.weblogs.com/0116284/ mpo@outerthought.org mpo@apache.org