cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lars Huttar" <lars_hut...@sil.org>
Subject Re: Writing to filesystem
Date Fri, 14 Nov 2003 18:38:26 GMT
Hi all,
The following was discussed back in July:


>    * From: Ali Mesbah
>    * Subject: Re: Writing to filesystem
>    * Date: Mon, 16 Jun 2003 05:54:12 -0700 
> 
> As quoted from Geoff Howard <[EMAIL PROTECTED]>:
> > It is complaining about the whitespace nodes between source:frament and 
> > title.
> > You'll get this anytime you overwrite a whole document.  To fix, just do 
> > something like:
> > 
> > ...
> >   <source:fragment><title>SourceWritingTransformer Test Result 
> > 1</title></source:fragment>
> > ...
> 
> Wonderful. Thanks it works :) 
> 
> 
> > At 08:39 AM 6/16/2003, you wrote:
> > >As quoted from Upayavira <[EMAIL PROTECTED]>:
> > >> > Hi,
> > >> >
> > >> > What is the best way to write the output of a Transformer (in a
> > >> > pipeline) into a file (e.g. /resources/bla.xml) on the filesystem?
> > >>
> > >> Check out the SourceWritingTransformer.
> > >
> > >I am checking it out. thanks. I'm getting an error though:
> > >
> > >failedThere was a problem manipulating your document: 
> > >org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to 
> > >insert a node where it is not permitted. 
> > >writenonefile:/resources/result.xml
> > >
> > >
> > >My xml source (called test.xml):
> > ><?xml version="1.0" encoding="UTF-8"?>
> > ><page>
> > ><source:write xmlns:source="http://apache.org/cocoon/source/1.0";>
> > >  <source:source>context://resources/result.xml</source:source>
> > >  <source:fragment>
> > >    <title>SourceWritingTransformer Test Result 1</title>
> > >  </source:fragment>
> > ></source:write>
> > ></page>
> > 

My problem is, the source fragment to be written out is
a text string, generated using a series of <xsl:text>
and <xsl:value-of> elements:
      <source:fragment>
          <xsl:text>-- SQL Server 2000 database schema for </xsl:text>
          <xsl:value-of select="system"/>
		...

Even if I eliminate space between <source:fragment> and <xsl:text>,
the same error still occurs.
However if I wrap the text items in a dummy element:
      <source:fragment>
        <dummy>
          <xsl:text>-- SQL Server 2000 database schema for </xsl:text>
          <xsl:value-of select="system"/>
		...
	   </dummy>
      </source:fragment>

the error goes away.
Presumably it's complaining because the content of <source:fragment>
is just that, an XML fragment, rather than a proper XML document
with one top-level node.
But how can that be? Surely you can write text files using
SourceWritingTransformer, not just XML documents.

Besides, it used to work... I have a copy of the file from 10 days ago
that was written out by this same pipeline. And I can't figure out
what might have changed.

Based on what Geoff said about overwriting, I tried deleting
the old file first in case that helped. It didn't.

Thanks for any hints,
Lars


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


Mime
View raw message