You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "JACOB, ERIC" <er...@bell.ca> on 2004/08/25 14:34:08 UTC

SourceWritingTransformer Problem

Hi,

It seems that I cannot use the SourceWritingTransformer to write document
that is in use by the pipeline.

I get the following error:

org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
java.lang.RuntimeException: org.apache.cocoon.ProcessingException: Could not
process your document.: java.io.IOException: Could not rename
E:\repos\moria\target\moria\test.xml.tmp to
E:\repos\moria\target\moria\test.xml

I have something like this into the sitemap:

      <map:match pattern="">
        <map:generate src="test.xml"/>
        <map:transform type="tofile"/>
        <map:serialize type="xml"/>
      </map:match>

How I could avoid this?

Thanks,

Eric




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


Re: SourceWritingTransformer Problem

Posted by Jorg Heymans <jh...@domek.be>.
there is a way of doing this in flow if you're interested.

var resolver =
cocoon.getComponent(Packages.org.apache.excalibur.source.SourceResolver.ROLE);
var source = resolver.resolveURI("URI for your modifiable source");
var outputstream = source.getOutputStream();
cocoon.processPipelineTo("page", outputstream);
resolver.release(source);
outputstream.close();


JACOB, ERIC wrote:

> Hi,
> 
> It seems that I cannot use the SourceWritingTransformer to write document
> that is in use by the pipeline.
> 
> I get the following error:
> 
> org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
> java.lang.RuntimeException: org.apache.cocoon.ProcessingException: Could not
> process your document.: java.io.IOException: Could not rename
> E:\repos\moria\target\moria\test.xml.tmp to
> E:\repos\moria\target\moria\test.xml
> 
> I have something like this into the sitemap:
> 
>       <map:match pattern="">
>         <map:generate src="test.xml"/>
>         <map:transform type="tofile"/>
>         <map:serialize type="xml"/>
>       </map:match>
> 
> How I could avoid this?
> 
> Thanks,
> 
> Eric


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


RE: SourceWritingTransformer Problem

Posted by "JACOB, ERIC" <er...@bell.ca>.
Hi Andreas,

In fact, here the full picture:

<map:match pattern="">
  <map:generate src="test.xml"/>
  <map:transform src="styles/test2source.xsl"/>
  <map:transform type="tofile"/>
  <map:serialize type="xml"/>
</map:match>

The first transformer gets the node I want to update, then modify (increment
by 1) and insert it in the source:fragment element... Maybe there is another
way to do this? But you're right: I'm trying to write to the same file I'm
reading from.

Thanks,

Eric

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Andreas Hartmann
Sent: Wednesday, August 25, 2004 10:25 AM
To: users@cocoon.apache.org
Subject: Re: SourceWritingTransformer Problem

JACOB, ERIC wrote:

> Hi,
> 
> It seems that I cannot use the SourceWritingTransformer to write document
> that is in use by the pipeline.
> 
> I get the following error:
> 
> org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
> java.lang.RuntimeException: org.apache.cocoon.ProcessingException: Could
not
> process your document.: java.io.IOException: Could not rename
> E:\repos\moria\target\moria\test.xml.tmp to
> E:\repos\moria\target\moria\test.xml
> 
> I have something like this into the sitemap:
> 
>       <map:match pattern="">
>         <map:generate src="test.xml"/>
>         <map:transform type="tofile"/>
>         <map:serialize type="xml"/>
>       </map:match>
> 
> How I could avoid this?

Are you trying to write to the same file you're reading from?
This doesn't work because you're handling with SAX, which
means the generator may still read from the file while the
transformer already tries to write to it.

-- Andreas


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




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


Re: SourceWritingTransformer Problem

Posted by Andreas Hartmann <an...@apache.org>.
JACOB, ERIC wrote:

> Hi,
> 
> It seems that I cannot use the SourceWritingTransformer to write document
> that is in use by the pipeline.
> 
> I get the following error:
> 
> org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
> java.lang.RuntimeException: org.apache.cocoon.ProcessingException: Could not
> process your document.: java.io.IOException: Could not rename
> E:\repos\moria\target\moria\test.xml.tmp to
> E:\repos\moria\target\moria\test.xml
> 
> I have something like this into the sitemap:
> 
>       <map:match pattern="">
>         <map:generate src="test.xml"/>
>         <map:transform type="tofile"/>
>         <map:serialize type="xml"/>
>       </map:match>
> 
> How I could avoid this?

Are you trying to write to the same file you're reading from?
This doesn't work because you're handling with SAX, which
means the generator may still read from the file while the
transformer already tries to write to it.

-- Andreas


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