cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martijn C. Vos" <>
Subject RE: XMLFileModule for a dynamic file.
Date Thu, 07 Jul 2005 13:02:32 GMT

I'm a bit late replying to this, but this sounds like something we do all the time
with almost all our projects, and we have a pretty simple solution for it which I
don't think I've seen here yet. (My apologies if someone else has already posted this.)

From: Alexander Berezhnoy [] wrote:

>  I want to extract data with XPath from an XML file whoes 
>  name depends on
>  request parameters.
>  The XMLFileModule is statically configured, so the file name 
>  is fixed.
>  Please, is it possible without writing my own module?

Unlike its name suggests, the XMLFileModule doesn't have to read a real file. It
can also read the result of a pipeline. And that pipeline can still ask for the
request parameters.


In a pipeline in the sitemap:

<map:generate src="{file:/foo/bar}/file.xml"/>

Configuration of the input module:

<component-instance class="org.apache.cocoon.components.modules.input.XMLFileModule" name="file">
    <file src="cocoon://somepipeline.xml"/>

Sitemap again:

<map:match pattern="somepipeline.xml">
  <map:generate src="data/{request-param:filename}.xml"/>

So this takes an XML file whose name depends on a request parameter, uses the XMLFileModule
to find a certain value from that file, and then uses the result as filename to get the file
you really

What we do is actually a bit more complicated than this, but this should work, as far as I


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

View raw message