cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Geindre <>
Subject Re: How to transform a subset of xml stream ?
Date Thu, 10 Jan 2008 16:45:05 GMT
Andrew Stevens a écrit :
>> Date: Fri, 21 Dec 2007 11:36:00 +0100
>> From:
>> Hi,
>> I have the following xml stream
>>     ...
>>     ....
>> I'd like to call my WFS transformer which make a call to a 
>> WebFeatureService with  xml stream in parameters, and 
>> keep  tag in the response.
>> th reponse should be :
>>        ...
>>          xml response of WFS web service
>> How can i write my sitemap to do that ?
>> Transform a subset of xml stream ?
> Nothing special so far as the sitemap goes, I'd say, just include your 
> transformer in the pipeline under the appropriate matcher.
> The "trick" is in the coding of your WFS transformer - by default have
> all the received events passed straight through to the registered
> consumer, until you receive a startElement for the wfs:GetFeature.
> At that point, start recording the subsequent events (i.e. the contents
> of the element) to a buffer or whatever, until there's an endElement
> for wfs:GetFeature.  At that point you call your WebFeatureService
> with the recorded parameters then send the consumer the
> appropriate event stream for the results instead of the original
> GetFeature element, in this case the wfs:featureCollection.
ok, thanks for your reply.
i am not use to write transformer component, could you provide me an 
example ?

my understanding is :
- make my own transformer inherited from AbstractDOMTransformer
- overwrite startElement and endElement
- make the WFS request when i am on  wfs:GetFeature node. (in 
endElement?), do nothing on other node
am i right ?

i am a bit lost with notify and transform method...
thanks again.
> Nothing unusual there, many of the existing transformers work the
> same way; everything gets passed through until a specific
> namespace and/or element is encountered, at which point they
> start recording the stream for later processing.  Some of them
> have a number of triggering elements, with a field to store the
> current state i.e. which of several buffers should currently be used
> for the recording.
> Andrew.

Sébastien Geindre
sebastien.geindre __at__

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message