cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miles Elam <>
Subject Flow questions
Date Fri, 17 Jan 2003 04:17:46 GMT
With the hope of using WebDAV or XML POST to update XML items on the 
server, I've been looking at Flow.  If you just want to see my flow 
questions, feel free to skip the preamble.


The back end data store is a PostgreSQL database whose relevant table 
looks something like this.  It has been abbreviated for clarity.

CREATE TABLE "shows" (
  "id" serial NOT NULL,
  "category" character varying(96), -- Useful for searches by topic
  "topic" character varying(64) NOT NULL,
  "abstract" character varying(1024),
  "promo" character varying(1024),
  "content" text,
  "liveDate" timestamp(0) with time zone,
  Constraint "shows_pkey" Primary Key ("id")

The incoming XML is based upon simplified docbook and looks something 
like this:

<show xmlns="">
    <topic>Small Web Dev Survival</topic>
      <participant userid="3"/>
      <participant userid="5"/>
      <participant userid="7"/>
    <promo>On the next Geek Speak: Jasper Larence, CEO of Words and 
Images of
      Santa Cruz, joins the Geeks for a discussion about the status of
      web development as a business.  [The quick growth of the Internet 
lead to
      an acute need for web development companies.  The crash saw the 
death of
      many of these new ventures.]  The survival of the web creation 
      on GeekSpeak, Monday [tomorrow/tonight] at 6:30pm on Central Coast 
      Radio, KUSP.</promo>
      <para>Jasper Larence, CEO of
        <orgname><ulink url="">Words &amp;
        Images</ulink></orgname> of Santa Cruz, joins the Geeks for a
        discussion about the status of web development as a business.  The
        quick growth of the Internet lead to a large need for web 
        companies.  The crash saw the death of many of these new 
ventures, but
        some companies like Words &amp; Images are still around.  Learn
    <title>What is web development?</title>
    <para>Blah blah blah blah blah...</para>

At first, I thought to convert the XML into XSP/ESQL.  That turned out 
to be a mess to the third power: a completely unmaintainable mess of 
markup and Java code.  I wouldn't expect anyone to happily fix any of my 
bugs in that rats nest nor would I expect to happily fix them myself six 
months down the road.

The next thought was Actions, but that was just keeping the code 
relatively out of sight.  It seemed fairly clumsy for any non-trivial 
amount (more than 100 lines) of logic and made the sitemap kinda crufty 
as well.


Next came Flow.  Although I didn't have multiple pages to work with as 
is the case with a wizard, it seemed to make a lot of sense in a 
predominantly procedural logic approach.  However, I ran into a few 
snags -- mostly related to lack of documentation (yes, I realize it's 
alpha and the API may be pulled out from under me...I'm prepared to deal 
with the search/replace/debug repercussions).  I'll keep my code snippet 
as short as possible.

function saveShow () {
  var showData;
  try {
    var factory      = 
    var builder      = factory.newDocumentBuilder();
    var showDocument = builder.parse( /* Somehow get the XML POST data 
in here */ );

    var showData = getShowData(showDocument);
  } catch ( e ) {

  try {
    var dbConn = /* Somehow get the datasource by name */.getConnection();
    var dbStatement = dbConn.createStatement();
    // ...snip a whole bunch of extraneous JDBC logic...
  } catch (sqle) {

1) How do I get XML POST data into the function (eg. equivalent to 
2) How do I look up a Cocoon datasource by name in JavaScript/Flow?
3) BSF question: Do I always have to call "foo.getBar()" or will 
"" work?
4) Am I doing something that will drive me into a brick wall, but I 
can't see it yet?  (Is this the correct approach to the problem?)


- Miles

Please check that your question  has not already been answered in the
FAQ before posting.     <>

To unsubscribe, e-mail:     <>
For additional commands, e-mail:   <>

View raw message