Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 81352 invoked by uid 500); 6 Dec 2002 05:33:33 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 81341 invoked from network); 6 Dec 2002 05:33:32 -0000 Message-ID: <177701c29ce9$58bfc0f0$0100a8c0@MAUCHI> From: "Ivelin Ivanov" To: References: <3DEDBE60.90100@cbim.it> <159501c29c18$c7c7bf60$0100a8c0@MAUCHI> <3DEF1007.9090306@cbim.it> Subject: Re: [Proposal] Implementing XMLForm with Flow Date: Thu, 5 Dec 2002 23:35:54 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Sorry I wasn't clear before. I know you can call Java from the flow. The question is how to use the flow in a way which significantly reduces code while making the maintenance easier and improving the readability. Try to beat the existing XMLForm wizard demo. If you succeed, it will be great ! Fingers crossed, Ivelin ----- Original Message ----- From: "Ugo Cei" To: Sent: Thursday, December 05, 2002 2:36 AM Subject: Re: [Proposal] Implementing XMLForm with Flow > Ivelin Ivanov wrote: > > I hope you are the last hero trying to confront this monster. > > > > The discussion how to combine the two has been going on forever, but we have > > not come to an agreement. > > I'm currently recovering the previous threads from the archive and > reading them. > > > I would gladly offer my tactical guidance for your effort. > > Thank you. > > > If I was to do this with Actions, I could use well known and standardized > > Java APIs - JWSP or JDBC. > > But, as Ovidiu pointed out, you can! > > var schemaFactory = > Packages.org.apache.cocoon.components.validation.SchemaFactory.lookup > ("http://www.ascc.net/xml/schematron"); > var is = new Packages.org.xml.sax.InputSource > ("flows/newuser-schema.xml"); > var schema = schemaFactory.compileSchema(is); > var validator = schema.newValidator(); > validator.setProperty("http://xml.apache.org/cocoon/validator/phase", > "NewUser"); > violations = validator.validate(userBean); > > This is just a quick hack I put together looking at the code for the > AbstractXMLFormAction and Form, but it works. I just need to define some > symbolic constants for the namespaces and find a way to access a > SourceResolver from JavaScript to make it pretty. > > Anyway, if you prefer to write complex business logic in Java (and I'd > agree wholeheartedly with that), you can encapsulate it in a Java method > that returns a boolean or an index to drive the flow that will be > implemented by an if/then/else or a switch in JavaScript. > > What do we gain by this? We remove flow logic from the sitemap in the > form of actions and put it in the flowscript, where it belongs (IMHO). > > Ugo > > -- > Ugo Cei - http://www.beblogging.com/blog/ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org > For additional commands, email: cocoon-dev-help@xml.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org