You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Williams, Murray Todd" <mu...@merck.com> on 2000/03/17 14:19:15 UTC

Does actually DO anything?

I've happily been using Cocoon for our intranet web site for several months
now.  Over time I've migrated everything (almost, still have some Java
servlets out there that think in HTML) to XML.  My team has gotten the SQL
Processor and LDAP Processor to work (that really embarrased someone when we
rewrote his fancy LDAP lookup "site" in ten lines or less), and we're still
developing.

Now I'm trying to turn an eye toward the "Formatter" step in the Cocoon
architecture.  We haven't had to think about it because it defaults to
"text/html" which is what we've wanted, so I haven't thought twice until
now.

We've used the XML Apache Formatting Objects (via command line) to generate
PDF views of some pages.  I questioned my team-mate asking her why we
weren't dynamically generating the PDF's on the fly with Cocoon, and she
told me she was under the impression you could only post-process the stuff
by hand on command line and offer static PDF files.  That didn't jive with
my impression of how Cocoon works, and I asked why she didn't use the
<?cocoon-format type="text/xslfo"?> directive in the XML source file.  She
tried that and nothing happened.

At that point I started to question my understanding of the architecture of
Cocoon.  I though the formatter decided how the internal DOM representation
of the XML document should be converted into an output data stream.  My
guess was that for HTML it would make sure that things like <br /> would be
converted to <br> sinced the former didn't quite work right in browsers,
etc.  I also guessed that the formatter would decide which mime type to tell
the browser it was getting, so may a "text/plain" would spit out raw text,
even if the content was a bunch of markup.

I couldn't find any good description in the documentation, so I decided to
run an experiment.  I took one of our projects fairly simple XML files and
added the <?cocoon-format?> directive and tried running it with "text/plain"
"text/html" and "text/xml" and saved the output (from the browser) to text
files.  I differenced the text files and found out that ***they were
identical*** (save the bottom comment line stating how many milliseconds it
took Cocoon to do the processing).

As one last desperate attempt, I set the format directive to "text/bob"
hoping that Cocoon would flag some sort of error since "text/bob" isn't
defined in the cocoon.properties file.  Nothing happened.  I tried moving
the placement of the line within the XML file.  Nothing happened.

Could someone please explain to me if the Cocoon formatter actually exists
or if I'm going insane?

Thanks,

Murray Todd Williams
Merck & Co., Inc.
MRL Data Warehouse Project