* Steve Krulewitz <[EMAIL PROTECTED]> [2004-02-28 16:13]:
> I agree that more sophisticated input handing would make general web 
> applications much easier to write in Cocoon... here are some more random 
> thoughts on the subject:

    ...

> 1. A deserializer component is used to convert the raw input into XML. 
> A deserializer component would be mated to each type of input -- for 
> example, the HTTPDeserializer would turn HTTP headers into a simple XML 
> document (or just selected parts of the header based on a parameter).

Do you create a new concept, deserializer, or do you just continue
    to use the generator concept?

    The HTTP deserializer you describe is a cool thing. I can
    imagine that there would be other sorts of desrializers, an EDI
    deserialiser, maybe an e-mail deserialzer if you want to accept
    e-mail messages as submissions, or an NNTP deserializer.

Cocoon an be a publishing framework for different protocols.

> <map:input-pipeline name="orders">
>   <map:aggregate>
>     <map:generate type="httpdeserializer">
>       <map:parameter name="query" value="customerid,orderid"/>
>    </map:generate>
>    <map:transform type="sql"/>
>    <map:serialize type="object"/>
> </map:input-pipeline>
> 
> ...
> 
> <map:pipeline match="/orders">
>   <map:input name="orders"/>
>   <map:generate type="jx"/>
>   <map:transform "orders.xslt"/>
>   <map:serialize/>
> </map:pipleline>

I'd much rather not deal with jx if I don't have to. I'd much rather
    move to input pipelines that can store input as XML in such a
    way that I can generate content using XSLT only.

I do like Mr Fagerstrom's idea to have input pipelines terminate in
    a store, then have them resume with an output pipeline.

I guess the word "deserialize" gave me an idea. Start a pipeline
    with a deserialize statement end it with a serialize statement.

<!--+
    | A pipeline that builds a validated document representing a
    | user registration. If a validator fails then an error document
    | is created and the error pipeline called -->

<map:match pattern="registration-validation">
  <map:generate type="c-form" src="forms/registration.cf"/>
  <map:transform src="styleshets/c-form/registration.xslt"/>
  <map:validate type="relax-ng" src="relax/registration.xml"/>
  <map:validate type="schematron" src="schematron/registration.xml"/>
</map:match>

<!--+
    | A pipeline that stores user mailing address and such into
    | a Momento document. If Momento rejects the update for some
    | reason (ACID) then an error document is created and the error
    | pipeline called -->

<map:match pattern="registration-momento-store">
  <map:generate src="cocoon:/registration-validation"/>
  <map:transform src="styleshets/xupdate/registration-to-momento.xslt"/>
  <map:store type="momento"/>
</map:match>

<!--+
    | A pipeline that makes note of session preferences. -->

<map:match pattern="registration-session-store">
  <map:aggregate element="session">
    <map:generate src="http-session"/>
    <map:generate src="cocoon:/registration-validation"/>
  </map:aggregate>
  <map:transform src="styleshets/xupdate/registration-to-session.xslt"/>
  <map:store type="session-document"/>
</map:match>

<!--+
    | A pipeline that stores user name and login to an ldap server.
    | If LDAP rejects the insert for some reason, then an error
    | document is created and the error pipeline is called.
    -->

<map:match pattern="registration-ldap-store">
  <map:generate type="c-forms" src="forms/registration.cf"/>
  <map:transform src="styleshets/ldap/registration-to-insert.xslt"/>
  <map:store type="ldap"/>
</map:match>

<map:match pattern="/registration-submit">

  <!--+ All or nothing.
      |
      | If any of the channels fail, then the error pipeline
      | triggers.  The error pipeline will start off with a generator
      | that will retrieve the error document. All validators write
      | their error messages as a sub-document in the error document.
      +-->

  <map:deserialize>
    <map:channel name="registration-momento-store"/>    
    <map:channel name="registration-session-store"/>    
    <map:channel name="registration-ldap-store"/>    
  </map:deserialize>

  <map:aggregate element="page">

    <!--| Navigation for page. |-->
    <map:generate src="layout.xml"/>

    <!--| Generate page content using the user that was stored
        | above |-->
    <map:generate type="momento"
                  src="momento/e-mail-service.mx"
                  xslt="stylesheets/momento/registration-page.xslt">
                  
      <!--| Liberal use of XPath in the sitemap |-->
      <map:parameter name="user-id"
                     value="{session://document#/document/@user-id}"/>

    </map:generate>

    <!--| Pull in the session document |-->
    <map:generate src="session://document"/>

  </map:aggregate>

  <!--| Make a form |-->
  <map:transform src="stylesheets/page-to-form.xml"/>

  <!--| Output |-->
  <map:serialize type="html"/>

</map:match>

Thoughts?

-- 
Alan / [EMAIL PROTECTED] / http://engrm.com/
    aim/yim: alanengrm - icq: 228631855 - msn: [EMAIL PROTECTED]

Reply via email to