You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ugo Cei <ug...@apache.org> on 2005/05/23 16:13:31 UTC

TeeTransformer

Hi,

I need something like the SourceWritingTransformer that would allow me 
to log, for debugging purposes, the contents of an XML document that is 
output by a generator. The problem with the SWT is that it expects its 
input to contain extra tags to direct its behavior, but my input does 
not contain such tags. I just need the transformer to save its input to 
a file as-is and stop at that.

The reason for this is that my application is receiving some XML 
documents over HTTP, so I'm using the StreamGenerator and a custom 
trasformer downstream, but for debugging I need to save the contents of 
the stream as they are received. So what I need is simply:

<map:generate type="stream"/>
<map:transform type="tee" src="debug.xml"/>
<map:transform type="custom"/>

Does anybody have some code for this to share?

	TIA,

		Ugo

-- 
Ugo Cei
Tech Blog: http://agylen.com/
Source.zone: http://sourcezone.info/
Wine & Food Blog: http://www.divinocibo.it/

Re: TeeTransformer

Posted by David Perez <cr...@yahoo.es>.
Ugo Cei schrieb:

> Hi,
>
> I need something like the SourceWritingTransformer that would allow me 
> to log, for debugging purposes, the contents of an XML document that 
> is output by a generator. The problem with the SWT is that it expects 
> its input to contain extra tags to direct its behavior, but my input 
> does not contain such tags. I just need the transformer to save its 
> input to a file as-is and stop at that.
>
> The reason for this is that my application is receiving some XML 
> documents over HTTP, so I'm using the StreamGenerator and a custom 
> trasformer downstream, but for debugging I need to save the contents 
> of the stream as they are received. So what I need is simply:
>
> <map:generate type="stream"/>
> <map:transform type="tee" src="debug.xml"/>
> <map:transform type="custom"/>
>
> Does anybody have some code for this to share?
>
>     TIA,
>
>         Ugo
>
Hi Ugo,

I made the FotoTransformer for exactly this purpose some time ago.  It 
should still be in the Cocoon wiki.

BR,
    David

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


Re: TeeTransformer

Posted by Jorg Heymans <jh...@domek.be>.
Ugo Cei wrote:
> Hi,
> 
> I need something like the SourceWritingTransformer that would allow me
> to log, for debugging purposes, the contents of an XML document that is
> output by a generator. The problem with the SWT is that it expects its
> input to contain extra tags to direct its behavior, but my input does
> not contain such tags. I just need the transformer to save its input to
> a file as-is and stop at that.
> 
> The reason for this is that my application is receiving some XML
> documents over HTTP, so I'm using the StreamGenerator and a custom
> trasformer downstream, but for debugging I need to save the contents of
> the stream as they are received. So what I need is simply:
> 
> <map:generate type="stream"/>
> <map:transform type="tee" src="debug.xml"/>
> <map:transform type="custom"/>
> 

Why not just write the Document to a file in the transform(Document doc)
method of AbstractDOMTransformer ?


Regards
Jorg


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