cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard McKenzie" <>
Subject RE: Custom Xpath Selector
Date Wed, 23 Jul 2008 07:04:18 GMT
Cheers Peter

Thanks for the advice, we are trying to avoid using flow script if
possible. I just thought I'd post the question in case anybody had
created a selector which did something similar, after decompiling all
the cocoon selectors I suspected that it was not possible to do

Many Thanks 

-----Original Message-----
From: Peter Hunsberger [] 
Sent: 22 July 2008 16:28
Subject: Re: Custom Xpath Selector

On Tue, Jul 22, 2008 at 10:04 AM, Richard McKenzie
<> wrote:


> Perhaps I am barking up the wrong tree and a selector is not the best 
> solution, it would be nice to be able to do different things bassed on

> the contents of the xml passed through a pipeline

If you have complicated use cases I suspect you're going to want to use
a Java transformer to inspect the XML in the pipeline and have it make
the decisions on what should be done.  This can be done from flow script
by firing off the pipeline at that point and then inspecting some
returned result.  I'm not sure about 2.1 but in 2.0 this looks like

 var sourceURI = "run/_checkXML/";
    var destinationURI = "xmodule:request-attr:checkXMLresult";

    var resolver = null;
    var destination = null;
    var output = null;
    try {
        resolver = cocoon.getComponent( );
        destination = resolver.resolveURI( destinationURI );
        output = destination.getOutputStream();
        cocoon.processPipelineTo( sourceURI, {}, output );

        if ( cocoon.request.getAttribute( "checkXMLresult" ) == ...) {
  //see what happened in the XML checking pipeline
           // Do whatever should be done based on the results...

            return true;
    finally {
        if (destination != null) {
            resolver.release( destination );
        cocoon.releaseComponent( resolver );
Peter Hunsberger
This e-mail (and any attachments) is confidential and may contain personal views which are
not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify
the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.

View raw message