Ivelin Ivanov wrote:
>
> ===============================================================
> ! The HTML Form symmetry loop is closed: !
> ===============================================================
> HTML Forms <-> XPath <-> JavaBeans <-> XML -> Schematron -> HTML Forms
> ===============================================================
>
> Just released the next version of the symmetric Form binding and validation
> toolkit ( a CocoonBlock wannabe :).
> In addition to the form-binding it now has integrated Schematron validation
> support.
>
> The zip file can be downloaded from:
> http://prdownloads.sourceforge.net/freebuilder/CocoonForm_0-6.zip
>
> With this in place one can provide form binding with just a few lines of
> code (~5 lines) and Sophisticated form validation with 0! lines of Java
> code.
>
> Let me walk you quickly through the sitemap of the example provided in the
> distribution:
>
> #########
> #sitemap:#
> ########
> ...
>
> <map:pipelines>
> <map:pipeline>
> <map:match pattern="*">
> 1. <map:act type="FormBinderAction"/> <!-- ### Uses The
> FormBeanBinder tool to bind the html form elements to an underlying JavaBean
> model through XPath based form element names -->
> 2. <map:generate src="insertFormBean.xml"/> <!-- ### This is a very
> short
> files simply inserting the form bean -->
> 3. <map:transform type="castor"/> <!-- ###
> CastorTransformer converts the bean into an XML stream -->
> 4. <map:transform src="schematron/xmlform-sch-report.xsl"/> <!-- ### A
> Schematron schema validates the form and adds the validation results in the
> stream, while preserving the original form stream -->
> 5. <map:transform src="formbean2html.xsl"/> <!-- ### Renders the HTML
> file
> using the XML form and the validation errors from the input document -->
> <map:serialize type="html"/>
> </map:match>
> </map:pipeline>
> </map:pipelines>
> ...
>
> ######################
> #xmlform-sch-report.xml: #
> ######################
>
> The validation schema is really simple and intuitive. The one in the example
> is over simplified.
> Schematron however supports i18n and validation in phases (useful for
> wizards).
>
> ...
> <schema ns="http://xml.apache.cocoon/xmlform"
> xmlns="http://www.ascc.net/xml/schematron">
> <title>Schema for the XML Form example</title>
> <pattern name="A Simple Form Validation Pattern">
> <rule context="name">
> <assert test="string-length(.) > 3">Animal name should be at least 4
> characters.</assert>
> <assert test="string-length(.) < 10">Animal name should be less than
> 10 characters.</assert>
> </rule>
> <rule context="scope">
> <assert test="normalize-space(.) = 'session' or normalize-space(.) =
> 'request'">Scope should be request or session.</assert>
> </rule>
> </pattern>
> </schema>
>
> =====================================
>
> That's all folks !
>
> All sources and xml documents are provided in the example.
>
> I will be working with Torsten on a more sophisticated wizard example
> and a best practices document.
>
> Cocoon is really close to becoming a full-blown web-app server,
> which enforces a pure separation in BOTH directions !
>
> I know everyone on this team is extremely busy, but even one line feedback
> is of great help for me, so
>
> Feedback please !
>
> Cheers,
>
> Ivelin
Way cool! I'll be glad to have it in the scratchpad as soon as you have
a cool sample to show the users.
Keep up the great work!
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<[EMAIL PROTECTED]> Friedrich Nietzsche
--------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]