cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivelin Ivanov" <>
Subject Re: [Announcement] re: HTML Form <-> XML <-> JavaBeans Binding [was: Re: Comitting components]
Date Mon, 11 Mar 2002 14:59:24 GMT

(sorry, hit sent unintentionally in my previous email )

>Could Schematron also be (re)used as a HTML Form Editor, running
>on the server side?

Yes, if you mean XML file validation while editing.
You can look at a Schematron schema as a set of XPath assertion rules against a target XML
It's really easy to use and understand. I don't have a clue why it was given such a scary
name ;)





Ivelin Ivanov wrote:

The next thing I plan to work on is a customized Schematron meta-stylesheetfor Cocoon, which
will be used for validation of HTML Forms (can be alsoapplied to SOAP messages).Before I do
that though, I'd like to ask for a vote to verify the interestin such a feature.Please vote
if you have opinions on this subject.The idea is basicly described by this state flow:server
side JavaBean -> cocoon -> html form -> browser -> http post ->Xpath/JavaBean
(the same one) -> XML -> Schematron Validation -> (nextaction | back to same html
form with errors )Schematron is an alternative to Martin and Christian's FormValidatorActionand
Descriptor.xml.It's designed to:1) provide easy to write XML structure assertions based on
XPath2) user-friendly error reporting mechanism3) Complimentary to XML SchemaBased on the
proposed CastorTransformer and FormBeanBinder, a Schematron<
br>trasnformer is a logical next step.Schematron has been polished and it is stable for
about a year now. Has aworking XSLT implementation.Proved successful for various applications.
Under a truly open sourcelicense (zlib/libpng
Hosted onSourceForge.Here are some referenes:home page:
forward to your comments.Ivelin----- Original Message -----From: "Ivelin Ivanov" <>To:
<>Cc: "Dmitri Plotnikov" <>Sent: Sunday,
March 10, 2002 6:47 AMSubject: Re: Comitting components<
    Folks,I think we might have made one small step towards HTML Form symmetry inCocoon.The
approach I have taken after long discussions and even longer hoursbefore my monitor is enhancing
the Cocoon Action concept so that it iscoherent with the rest of the framework.Thanks to the
people who built JXPath  and  Castor (and
      I think we now have a way to elegantly map content to business logic.
        Forms <-> XML/XPath <-> JavaBeans)The idea has been in circulation for
a long time: unmarshal JavaBeans fromthe buziness layer to XML, so that they can be part of
the content model
          then use XPath expressions for HTML Form elements so that on POST the sameJavaBean
can be updated and sent back to the business logic.You can download a scratchpad formatted
bundle here:'ve only used Apache
licensed files this time ;)The examples are based on the CastorTransformer examples, so they
            easy to comprehend.The code is very simple. I've tried not to touch more advanced
              error handling and reporting, unusual custom mapping and multi page
                Thought I should first present to the rest of the group a simple prototypefor
feasibility test .Below I will show just a sample XSL file which takes an XML presentation
                  a JavaBean and renders HTML forms with the appropriate XPath expressions.
                    will hopefully sharpen your apetite enough to make you look at the code
                      participate in thediscussion:---------------------------- <xsl:stylesheet
xmlns:xsl=""version="1.0">  <xsl:output method="html"
omit-xml-declaration="yes" />- <xsl:template match="/zoo">- <html>- <body>
 Please edit and submit:  <br />  <xsl:apply-templates />  </body>  </html>
 </xsl:template>- <xsl:template match="animal[1]">- <form method="post" action="test">
 <xsl:variable name="animalName" select="name" />  Animal name:  <input type="text"
name="name" value="{$animalName}" />  <br />  Kind:- <b>  <xsl:value-of
select="personalInfo/@kind" />  </b>  <br />  <xsl:variable name="animalScope"
scope" />  Animal scope:  <input type="text" name="scope" value="{$animalScope}" />
 <br />  <xsl:variable name="preference1" select="preferences[1]" />  First Preference:
 <input type="text" name="preferences[1]" value="{$preference1}" />  <br />  <xsl:variable
name="preference2" select="preferences[2]" />  Second Preference:  <input type="text"
name="preferences[2]" value="{$preference2}" />  <br />  <input type="submit"
/>  </form>  <br />  Counter:  <xsl:value-of select="@count" />  </xsl:template>
 <xsl:template match="*" />  </xsl:stylesheet>----------------------------------Looking
forward to comments.Cheers,Ivelin----- Original Message -----From: "Ivelin Ivanov" <ivelin@iname.c
om>To: "Nicola Ken Barozzi" <>;
                        Cc: <"[dplotnik@"@iname.comSent: Thursday, March 07, 2002 3:57
PMSubject: Re: Comitting components
                          Way cool !We've been using castor .93 for quite serious xml traffic
                            win c++ clients and a java portal. Great performance.
                              Donating this transformer also saved me some work.As I mentioned
before I am workin on a little prototype that'll
                                introduce some HTML Forms symmetry in cocoon.
                                  From an earlier email by Konstantin:
                                    It would be also fine to have an action that >performs
the oppositeoperation: set properties of JavaBean object(s) with request param
                                          using XPath expressions, e.g.:customer/firstname
= Ozzycustomer/lastname = Osbournecan be converted to XML:<customer>   <firstname>Ozzy</firstname>
                                          I am working on this with Dmitri's help using his
JXPath lib.'s being used for Jakarta
JSTL and Workflow (which says enough for its
                                            Let me know if someone else is working in this
direction so that we
                                              double the work.
                                                Regards,Ivelin-----Original Message-----From:
"Nicola Ken Barozzi" <>Date: Thu, 7 Mar 2002 18:03:30 +0100To: 
<>Subject: Re: Comitting components
                                                  From: "Matthew Langham" <>
                                                    today two new "things" were donated/comitted
to the Cocoon
                                                    scratchpad -
                                                          Castor Transformer and the POI Serialization
code.It would help people like me (who do not read all the messages or
                                                                  remember them all) if comitters
could add a couple of lines or
                                                                        to what can be done
with the new components when sending off theannouncements.
                                                                        You are right. Thank
you for the pointer.Here is a brief explanation.---------------------- POI Serializer----------------------The
POI project, now hosted on , is a
                                                                            that consists
of APIs for manipulating various file formats based uponMicrosoft's OLE 2 Compound Document
format using pure Java. OLE 2
                                                                                Document Format
based files include most Microsoft Office files such
DOC.The HSSFSerializer uses POI's HSSF xls file write API
, and is now in Cocoon
(not scratchpad).It makes it possible to output xml following the schema of gnumeric to



    xls file.Examples are present in the "extra" section, under "legacy file
        To install the Cocoon war easily, do:build.(sh|bat) cleanbuild.(sh|bat) installwar----------------------------
Castor Transformer (in scratchpad)----------------------------Marshals a object from the the
sitemap, request, session or Servlet
            into a series of SAX events, and can seek for the java bean
                TheCastortransformer can be configured with a default mapping. This
                    is used as long as no other mappings are specified.  <map:transformer
                            <mapping>castor/xmapping.xml</mapping>  </map:transformer>A
sample for the use:   <root xmlns:castor="">
     <castor:InsertBean source="session" key="invoice"/>      <castor:InsertBean
source="sitemap" key="product"               mapping="castor/specicalmapping.xml"/>   </root>The
CastorTransfomer support only one Element castor:InsertBean.This element is replaced with
the marshalled object.Other information can be found in the scratchpad sample sub-sitemap
                            docs.To install the Cocoon war with scratchpad stuff easily, do:build.(sh|bat)
cleanbuild.(sh|bat) installscratchpadwarThe demo is under http://server:port/cocoon/samples/castor/--Nicola
Ken Barozzi                     - verba volant, scripta manent
-   (discussions get forgotten, just code remains)------------------------------------------------------------------------------------------------------------------------------------------To
unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.orgFor additional commands, email:
                            --_______________________________________________Sign-up for your
own FREE Personalized E-mail at Mail.com is giving
away two million travel miles.
unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.orgFor additional commands, email:
unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.orgFor additional commands, email:
unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.orgFor additional commands, email:

View raw message