You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nicolas Rod <co...@alaxos.com> on 2005/02/23 17:22:27 UTC

XML flow content access in Components

Hi all,

I'd like to know if there is a possibility to access the XML flow 
content in a custom Selector. The goal would to test the presence or not 
of a special tag (an 'xinclude') in the XML flow generated above in a 
pipeline.

Is there a way to access the flow content in the Selector, in order to 
make a XPATH query for instance ?

Thanks a lot,
Nicolas Rod

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


Re: XML flow content access in Components

Posted by Nicolas Rod <co...@alaxos.com>.
Le message suivant a été écrit par Nicolas Rod le 25. 02. 05 15:13:
> Le message suivant a été écrit par Reinhard Poetz le 23. 02. 05 17:42:
> 
>> Nicolas Rod wrote:
>>
>>> Hi all,
>>>
>>> I'd like to know if there is a possibility to access the XML flow 
>>> content in a custom Selector. The goal would to test the presence or 
>>> not of a special tag (an 'xinclude') in the XML flow generated above 
>>> in a pipeline.
>>>
>>> Is there a way to access the flow content in the Selector, in order 
>>> to make a XPATH query for instance ?
>>
>>
>>
>> yes, use the method getContextObject of the 
>> org.apache.cocoon.components.flow.FlowHelper
>>
> 
> Hi,
> 
> I tried to look for in this direction but couldn't find out how to use 
> your answer. I must admit I am a newbie with cocoon.
> 
> I added this line in the select(...) method of a Selector:
> 
>    Object flowContext = FlowHelper.getContextObject(objectModel) ;
> 
> And flowContext returned is null.
> 
> I looked a little on the web for FlowHelper, and everything I found was 
> related to control flow. So far, I haven't used control flow at all, but 
> only custom generators and actions.
> 
> I'd like to have someting similar to:
> 
> <map:match pattern="**.html">
>   <map:generate type="MyGenerator" src="..."/>
>   <map:select type="tagExists">
>     <map:when test="myTag">
>       <map:read src="myPage1.html" mime-type="text/html"/>
>     </map:when>
>     <map:otherwise>
>       <map:read src="myPage2.html" mime-type="text/html"/>
>     </map:otherwise>
>   </map:select>
> </map:match>
> 
> And depending on the presence of the xml tag "myTag" generated by 
> MyGenerator, read myPage1, or myPage2.
> 
> Can we use FlowHelper in a Selector, and access the generated XML, 
> without using control flow ?
> 
> Thanks for your help

Hello,

Any idea about the way to build such a selector ?

Thanks a lot, as I can't go further without help...

Nicolas

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


Re: XML flow content access in Components

Posted by Nicolas Rod <co...@alaxos.com>.
Le message suivant a été écrit par Reinhard Poetz le 23. 02. 05 17:42:
> Nicolas Rod wrote:
> 
>> Hi all,
>>
>> I'd like to know if there is a possibility to access the XML flow 
>> content in a custom Selector. The goal would to test the presence or 
>> not of a special tag (an 'xinclude') in the XML flow generated above 
>> in a pipeline.
>>
>> Is there a way to access the flow content in the Selector, in order to 
>> make a XPATH query for instance ?
> 
> 
> yes, use the method getContextObject of the 
> org.apache.cocoon.components.flow.FlowHelper
> 

Hi,

I tried to look for in this direction but couldn't find out how to use 
your answer. I must admit I am a newbie with cocoon.

I added this line in the select(...) method of a Selector:

    Object flowContext = FlowHelper.getContextObject(objectModel) ;

And flowContext returned is null.

I looked a little on the web for FlowHelper, and everything I found was 
related to control flow. So far, I haven't used control flow at all, but 
only custom generators and actions.

I'd like to have someting similar to:

<map:match pattern="**.html">
   <map:generate type="MyGenerator" src="..."/>
   <map:select type="tagExists">
     <map:when test="myTag">
       <map:read src="myPage1.html" mime-type="text/html"/>
     </map:when>
     <map:otherwise>
       <map:read src="myPage2.html" mime-type="text/html"/>
     </map:otherwise>
   </map:select>
</map:match>

And depending on the presence of the xml tag "myTag" generated by 
MyGenerator, read myPage1, or myPage2.

Can we use FlowHelper in a Selector, and access the generated XML, 
without using control flow ?

Thanks for your help

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


Re: XML flow content access in Components

Posted by Reinhard Poetz <re...@apache.org>.
Nicolas Rod wrote:
> Hi all,
> 
> I'd like to know if there is a possibility to access the XML flow 
> content in a custom Selector. The goal would to test the presence or not 
> of a special tag (an 'xinclude') in the XML flow generated above in a 
> pipeline.
> 
> Is there a way to access the flow content in the Selector, in order to 
> make a XPATH query for instance ?

yes, use the method getContextObject of the 
org.apache.cocoon.components.flow.FlowHelper

-- 
Reinhard Pötz           Independant Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

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