cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Anderson <benanderson...@gmail.com>
Subject Re: populate xmlbean in flow w/ pipeline
Date Sat, 05 Mar 2005 11:48:37 GMT
yes, that's it! - and that will probably work for us.  But I'm
curious, instead of this line:
pipelineUtil.processToSAX( "internal/catalog/getCatalog", null,
xmlSaxHandler.getContentHandler() );
which I'm assuming starts a new pipeline, can I just grab what the
"state" the pipeline was in before entering flow (the output from the
tranform)?
      <map:match pattern="somePattern*">
        <map:generate type="request"/>
        <map:transform src="someXsl.xsl" label="myLabel"/>
        <map:call function="{someFunction}"/>

Does this make sense?
Thanks,
Ben

On Sat, 05 Mar 2005 04:19:10 -0500, Irv Salisbury III <irv@dotech.com> wrote:
> Actually, I found my example:
> 
> importClass( Packages.org.apache.xmlbeans.XmlBeans );
> importClass( Packages.com.thinkreports.catalog.CatalogDocument );
> importClass( Packages.com.thinkreports.util.XMLBeansXMLizableWrapper );
> importClass(
> Packages.org.apache.cocoon.components.flow.util.PipelineUtil );
> 
> function getCatalog() {
> // get ourselves a tool to get some XML
> var pipelineUtil = cocoon.createObject( PipelineUtil );
> 
> // get the XML
> var xmlSaxHandler = XmlBeans.getContextTypeLoader().newXmlSaxHandler(
> CatalogDocument.type, null );
> pipelineUtil.processToSAX( "internal/catalog/getCatalog", null,
> xmlSaxHandler.getContentHandler() );
> var catalog = xmlSaxHandler.getObject();
> cocoon.log.debug( "Catalog object before return is " + catalog );
> 
> return new XMLBeansXMLizableWrapper( catalog );
> 
> }
> 
> In this case, we wrote an XMLBeansXMLizableWrapper so that we could
> store the XMLBean as an attribute that implements XMLizable.  You can
> then use the xmodule to generate directly from that object.
> 
> Irv
> 
> Ben Anderson wrote:
> 
> >Hi,
> >I'd like to take the state of my current pipeline and populate an
> >xmlbean from this in the flowscript.  Is this something that's already
> >easy to do?  Here's what I'd like to do:
> >
> >      <map:match pattern="somePattern*">
> >        <map:generate type="request"/>
> >        <map:transform src="someXsl.xsl" label="myLabel"/>
> >        <map:call function="{someFunction}"/>
> >      </map:match>
> >
> >After the xsl transform, I will have a valid instance of my xmlbean.
> >Then in my flow script I could do something like this:
> >
> >  var sh = org.apache.xmlbeans.XmlObject.Factory.XmlSaxHandler();
> >  var ch = sh.getContentHandler();
> >  <this is what I'm missing>
> >  var myBean = sh.getObject();
> >
> >Am I on the right track here?  Looking through this page:
> >http://cocoon.apache.org/2.1/userdocs/flow/api.html
> >I don't see any objects that can send events to the contenthandler...
> >
> >Any guidance is appreciated.
> >Thanks,
> >Ben
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message