You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Donald Ball <ba...@webslingerZ.com> on 2000/01/21 05:03:33 UTC

CGI::XMLForm

Hey guys -

I was recently working with XML/XSLT for a project for which I was unable
to use cocoon and had to explore some of the other tools out there. The
app was pretty simple - take in an HTML form whose fields describe what a
fairly complicated HTML page should look like and generate said page XSLT
sounded perfect to generate the final output, but I needed a way to take
the form data and turn it into some nice looking XML. Sure, I though, I
could use XSP and reference fields like this:

<request:get-variable name="foo"/>

(or something like that, anyway) but then all of my variables exist in a
flat namespace, and the stylesheet I was writing to turn that into the
HTML page was getting really scary. I realized that what I wanted was
something that let me describe where the HTML form fields belonged in an
structured XML document and would generate it for me. I found what I was
looking for, more or less, in a perl module (god forbid that anything
useful be found there :)). CGI::XMLform let me transform HTML forms that
look something like this:

<form>
 <input type="text" name="/page/header/title">
 <input type="text" name="subtitle">
 <input type="text" name="../body">
</form>

into xml that looks something like this:

<page>
 <header>
  <title>...</title>
  <subtitle>...</title>
 </header>
 <body>...</body>
</page>

in essence, you name the html form elements according to an XPath-like
syntax and the perl module builds the XML document for you. It's not a
perfect tool (I even found a bug or two) but it sure got the job done.

Anyway, if you're into that kind of thing at all, I recommend checking it
out from your nearest CPAN archive. The reason I bring it up here is to
see if anyone would be interested in working on something similar for
cocoon?

- donald


strange behavior

Posted by Laurian Gridinoc <do...@thedot.net>.
I was expecting that XSP won't work :)

Instead this is perfect [and superb] but something very strange is
happening:

anypath/any_[non]_existant_file.xml [even /Cocoon.xml]
is served as the 'Cocoon Live Show' page [samples/index.xml]

example:
samples/hello/hello-page.xml  -- i get samples/index.xml
samples/hello/hello-page.xml?whatever -- works okay :) [that's why all the
XSP examples works]

now i will disable the caching in cocoon...
...and it works okay.

enabling the caching...
...wrong again

I'm using Apache 1.3.9, Jserv 1.1b2, jdk 1.1.7; on RedHat 6.1

Laurian Gridinoc
Chief Technology Officer
thedot.net, Inc.
www.thedot.net
--
Hell is empty and all the devils are here.
  -- Shakespeare, "The Tempest"