On Thu, 2004-08-05 at 05:55, Mark Lundquist wrote:
> On Aug 4, 2004, at 8:22 PM, Tony Edwards wrote:
>
> Mark,
> Thanks for the pointer regarding the session object. I'll
> check it out.
> To get my document into the pipeline, I do the following:
>
> Once I've stored the xml document in session I user the
> sessiongenerator in my pipeline to grab it and transform it:
>
> <map:match
> pattern="internal/tree-menu">
> <map:generate type="session-attr">
> <map:parameter name="attr-name"
> value="hrcyDoc"/>
> </map:generate>
> <map:tansform
> src="xml2tree.xsl"/>
> <map:serialize type="html" />
> </map:match>
>
> The session-attr generator refers to the
> SessionAttributeGenerator,declared thus:
> <map:generator
>
> name="session-attr"logger="sitemap.generator.session-attr"src="org.apache.cocoon.generation.SessionAttributeGenerator"/>
>
> It just grabs a session attribute object which in this case is
> the xmldocument we've cobbled together from the flowscript.
>
> Hope this helps!
>
> That does help. It helps a lot! Thanks, Tony...
>
> It's now on my to-do list to spiff up the userdoc
> forSessionAttributeGenerator :-)... there's not a whole lot there
> rightnow :-/.
>
> It would be slightly more elegant
"slightly" is an understatement IMHO, putting data in the session which
shouldn't be there is just plain ugly.
> to be able to passthe source data in directly to sendPage() instead
> of stashing it inthe session, but that hardly seems to justify the
> trouble of writing awhole damn generator
What you need is the module source combined with the flow-attribute
input module.
The module source is a source which gets its data from an input module.
The usage is something like:
<map:generate src="module:flow-attribute:mything"/>
where 'mything' is the key used in the object passed to sendPage, ie
sendPage("...", {"mykey": someObject});
The type of someObject should be either an InputStream or a String. If
you have your data retrieved in a byte array you can easily wrap it in a
ByteArrayInputStream.
OTOH, if you have your data already as a DOM-tree or an object
implementing XMLizable, you can use the XModuleSource (still in
scratchpad).
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED] [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]