cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist <mlundqui...@comcast.net>
Subject Re: XMLFileModule for a dynamic file.
Date Fri, 01 Jul 2005 08:26:27 GMT

On 2005-06-01 06:11:24 -0700, "Alexander Berezhnoy" 
<alexander.berezhnoy@splc.ru> (on users@cocoon.apache.org) said:

> Dear friends,
> I've been looking for this feature for a week already, nobody and nowhere
> can't give me a definite answer.
> 
> 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?

I ran across this thread today, because I need exactly this very same 
thing! :-)  Alexander, I saw another post of yours around the same 
time, maybe on the dev group or somewhere... I too was faked out a 
little bit by the mention of "dynamic" configuration" in the comments 
for XMLFileModule.  It looks like that stuff (the modConf parameter to 
getAttribute() and friends) is there for use by other Cocoon 
components... see LinkRewriterTransformer for an example.  If you think 
about it, for what you wanted (and what I want :-), the only way to 
specify the source name would have to be in the attribute name syntax 
for the module.  If you don't see it there, then it ain't there and 
this module doesn't do what we want :-/.

So, what I'm after would be an XPathModule, invoked in the sitemap like this:

	{xpath:source-uri#xpath-expression}

e.g. (in the particular appl'n I have for this just now :-):

	<map:relocate-to uri="{xpath:{1}#/relocate-to/@uri}" />

It looks like a reasonable strategy would be to factor most of 
XMLFileModule into a new class AbstractXMLFileModule, and then extend 
this to implement XPathModule.  Comments?

—ml—



Mime
View raw message