You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by João César <jo...@duploclique.com> on 2003/04/04 17:40:45 UTC

SourceWrite error :|

Hi all,

We're getting this error on sourcewrite transformer:

"The src attribute doesn't resolve to a writeable source and failed to
cancel "

The generator src is:

erro.xml:

<?xml version="1.0"?>
<page xmlns:source="http://apache.org/cocoon/source/1.0">
   <source:write src="context://pubmed/repository/my.xml">
     <page>
       XML Object body
     </page>
   </source:write>
 </page>

in the sitemap we have:

<map:match pattern="erro">
    <map:generate type="file" src="documents/erro.xml"/>
    <map:transform type="tofile">
        <map:parameter name="serializer" value="xml"/>
    </map:transform>
    <map:serialize/>
</map:match>

and the my.xml file is in the correct directory... :|

What's wrong?

Thanks in advance,

Joao Cesar
joaocesar@duploclique.com





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


Re: SourceWrite error :|

Posted by Upayavira <uv...@upaya.co.uk>.
> Just to thank you, aggregate is working fine :)

I'm glad. 

> We currently have (another :|) small problem with {request:query} when
> we get the parameter from the querystring, because if the querystring
> is search?query=word1+word2 i think that we're not getting the two
> words (just the first), but if we put in the search form word1+word
> (without quotes)..
> 
> We've tried xpath command translate this way:
> {request:translate(query,' ','+')} but with no results :|
> 
> And is there any way to use querystring parameters within a XSL file?

Don't know if it answers all of your questions, but you can use {request-
param:query} 
to get at parameters. {request:xxx} gets at the request itself.

Try that. Regards, Upayavira


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


Re: SourceWrite error :|

Posted by João César <jo...@duploclique.com>.
Just to thank you, aggregate is working fine :)

We're proceeding on the application, when we get it done we'll post a test
URL here :)

We currently have (another :|) small problem with {request:query} when we
get the parameter from the querystring, because if the querystring is
search?query=word1+word2 i think that we're not getting the two words (just
the first), but if we put in the search form word1+word (without quotes)..

We've tried xpath command translate this way: {request:translate(query,'
','+')} but with no results :|

And is there any way to use querystring parameters within a XSL file?

Sorry about so many questions, we're getting excited with cocoon :D lol

Joao Cesar
joaocesar@duploclique.com

Computer Science Student's @ University of Lisboa, PORTUGAL



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


Re: SourceWrite error :|

Posted by Upayavira <uv...@upaya.co.uk>.
> We're thinking that you're a god (lol), because you're just telling us
> the problem we just had discovered, so we're thinking that you're a
> mindreader.... :) kidding :)

Gee. Maybe those years of meditation are working in ways I didn't expect!

> Actually, we we're empty the temporary internet files everytime we
> wanted to check if he was merging the files lolol But incredibly it is
> really working :) So, we're thinking that in the end, cocoon isn't to
> bad as we thought...

It is rather good, actually!

> Thanks once again

You're welcome.

Upayavira


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


Re: SourceWrite error :|

Posted by João César <jo...@duploclique.com>.

> I would suggest using an aggregator and avoiding the document() function
within
> Cocoon. Cocoon will not know that you have referred to an external
document, and
> thus will not take this into account when deciding whether to serve a
cached page or
> not. Thus your employeeNames.xml file might change, but Cocoon wouldn't
notice,
> and thus would serve the cached version - not good. Therefore, the advice
is avoid
> document() and use an aggregator.

We're thinking that you're a god (lol), because you're just telling us the
problem we just had discovered, so we're thinking that you're a
mindreader.... :) kidding :)

Actually, we we're empty the temporary internet files everytime we wanted to
check if he was merging the files lolol But incredibly it is really working
:) So, we're thinking that in the end, cocoon isn't to bad as we thought...

We'll change to the aggregate function, as you said.

Thanks once again

Joao Cesar
joaocesar@duploclique.com

Computer Science Student's @ University of Lisboa, PORTUGAL




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


Re: SourceWrite error :|

Posted by Upayavira <uv...@upaya.co.uk>.
> We we're able to do that this way:
> ...
>     <xsl:variable name="emps" select="document('employeeNames.xml')"/>
> ...

I would suggest using an aggregator and avoiding the document() function within 
Cocoon. Cocoon will not know that you have referred to an external document, and 
thus will not take this into account when deciding whether to serve a cached page or 
not. Thus your employeeNames.xml file might change, but Cocoon wouldn't notice, 
and thus would serve the cached version - not good. Therefore, the advice is avoid 
document() and use an aggregator.

> But what we see in your example, is that we can accomplish the other
> objective we've just asked, by transforming one time to the source
> write, and transform another time to html, and then show the results
> to browser :)
> 
> We'll try your tips on that!

Hope it works.

Upayavira


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


Re: SourceWrite error :|

Posted by João César <jo...@duploclique.com>.
Hi, first of all thanks for your answer :)

We we're able to do that this way:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
    <xsl:output method="xml"/>
    <xsl:variable name="emps" select="document('employeeNames.xml')"/>
    <xsl:template match="/">
        <employees>
        <xsl:for-each select="employees/child::*">
            <xsl:copy-of select="."/>
        </xsl:for-each>
        <xsl:for-each select="$emps/employees/child::*">
            <xsl:copy-of select="."/>
        </xsl:for-each>
        </employees>
    </xsl:template>
</xsl:stylesheet>

In the above code, we copy every employees entries from the file in the
generator pipeline, and thenthe employees entries on the $emps xml document,
and enclose by a <employees> tag, and it worked fine...

But what we see in your example, is that we can accomplish the other
objective we've just asked, by transforming one time to the source write,
and transform another time to html, and then show the results to browser :)

We'll try your tips on that!

Thanks again :)

Joao Cesar
joaocesar@duploclique.com

Computer Science Student's @ University of Lisboa, PORTUGAL



----- Original Message -----
From: "Upayavira" <uv...@upaya.co.uk>
To: <co...@xml.apache.org>
Sent: Saturday, April 05, 2003 7:31 PM
Subject: Re: SourceWrite error :|


> > Yeah... but that way I can do it grabbing the new data in the
> > generator pipeline, and in the transformer grab the local repository
> > to merge with, or grab the local data in the generator, and then grab
> > the remote data on by xslt... what's easier?
>
> I would use an aggregator:
>
> <map:match pattern="xxxxx">
>   <map:aggregate element="page">
>     <map:part src="newcontent.xml"/>
>     <map:part src="originalsource.xml/">
>   </map:aggregate>
>   <map:transform src="prepare-source.xsl"/>
>   <map:transform type="source-writing"/>
>   <map:transform src="source-result.xsl"/>
>   <map:serialize type="html"/>
> </map:match>
>
> Here you aggregate your two xmls into a single stream wrapped with a
<page>
> node. Then you transform these two xmls into a form ready for the source
writing
> transformer. Then you do the source write. Then, finally, you convert the
result of
> the write into html to present success or failure to the web user.
>
> Make sense?
>
> Regards, Upayavira
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>



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


Re: SourceWrite error :|

Posted by Upayavira <uv...@upaya.co.uk>.
> Yeah... but that way I can do it grabbing the new data in the
> generator pipeline, and in the transformer grab the local repository
> to merge with, or grab the local data in the generator, and then grab
> the remote data on by xslt... what's easier?

I would use an aggregator:

<map:match pattern="xxxxx">
  <map:aggregate element="page">
    <map:part src="newcontent.xml"/>
    <map:part src="originalsource.xml/">
  </map:aggregate>
  <map:transform src="prepare-source.xsl"/>
  <map:transform type="source-writing"/>
  <map:transform src="source-result.xsl"/>
  <map:serialize type="html"/>
</map:match>

Here you aggregate your two xmls into a single stream wrapped with a <page> 
node. Then you transform these two xmls into a form ready for the source writing 
transformer. Then you do the source write. Then, finally, you convert the result of 
the write into html to present success or failure to the web user.

Make sense?

Regards, Upayavira


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


Re: SourceWrite error :|

Posted by João César <jo...@duploclique.com>.
> In 2.1, you can use insert. In 2.0.4, you'll need use XSLT to merge the
data and then
> write the whole file back to disc. Make sense?

Yeah... but that way I can do it grabbing the new data in the generator
pipeline, and in the transformer grab the local repository to merge with, or
grab the local data in the generator, and then grab the remote data on by
xslt... what's easier?

Thanks

Joao Cesar
joaocesar@duploclique.com

Computer Science Student's @ University of Lisboa, PORTUGAL




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


Re: SourceWrite error :|

Posted by Upayavira <uv...@upaya.co.uk>.
> thaaaaaaaanks :)
> It worked :)

Great! It is pleasing when logic prevails!
 
> Now I just have one question: I use the <source:write> tag to write to
> the file, and overwriting it, but what if I want to append data to the
> existing file ? Can i use the <source:insert> tag? Or is it another
> way to do it ?

In 2.1, you can use insert. In 2.0.4, you'll need use XSLT to merge the data and then 
write the whole file back to disc. Make sense?

Upayavira

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


Re: SourceWrite error :|

Posted by João César <jo...@duploclique.com>.
thaaaaaaaanks :)

It worked :)

Now I just have one question: I use the <source:write> tag to write to the
file, and overwriting it, but what if I want to append data to the existing
file ? Can i use the <source:insert> tag? Or is it another way to do it ?

It's late now here in Portugal, but tomorrow I will test how to do it.

Thanks for your help!!! :)

Joao Cesar
joaocesar@duploclique.com



----- Original Message -----
From: "Upayavira" <uv...@upaya.co.uk>
To: <co...@xml.apache.org>
Sent: Friday, April 04, 2003 9:57 PM
Subject: Re: SourceWrite error :|


> > Yes, but the error keeps going on.. I'll check that later, and search
> > a little more deep for help on documentation...
>
> Okay. Check in your $COCOON-HOME/WEB-INF/cocoon.xconf and make sure
> you've got this entry:
>
>   <source-handler logger="core.source-handler">
>     <!-- file protocol : this is a WriteableSource -->
>     <protocol
class="org.apache.cocoon.components.source.FileSourceFactory"
> name="file"/>
>
>   </source-handler>
>
> That being missing could cause the problem.
>
> Upayavira
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>



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


Re: SourceWrite error :|

Posted by Upayavira <uv...@upaya.co.uk>.
> Yes, but the error keeps going on.. I'll check that later, and search
> a little more deep for help on documentation...

Okay. Check in your $COCOON-HOME/WEB-INF/cocoon.xconf and make sure 
you've got this entry:

  <source-handler logger="core.source-handler">
    <!-- file protocol : this is a WriteableSource -->
    <protocol class="org.apache.cocoon.components.source.FileSourceFactory" 
name="file"/>

  </source-handler>

That being missing could cause the problem.

Upayavira

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


Re: SourceWrite error :|

Posted by João César <jo...@duploclique.com>.
> No, that is syntax for 2.1 AFAIK, not 2.0.4. You need <source:write
src="..."> as
> you had.

I've noticed that, because I've seen in some examples that they used other
notation, like <source:source> to represent that, but in fact, we're using
cocoon 2.0.4 + tomcat 4.1.


> Believe me, it does get easier as you get used to how to work with Cocoon.
And
> there are discussions going on at the moment about how to improve
> documentation for people like yourself...check out the Wiki
(wiki.cocoondev.org).

I can see some flexibility separating both data (XML) from an apresentation
layer, (done by XSLT for example), and I would like, to keep exploring this
technology :) I've checked out wiki.cocoondev.org, but it seems it lacks on
simple yet effective examples, but it's normal because this is a "recent"
technology...


> I've had it working, so it is possible.

You gave me hope then :) hehe

>
> I used the sample that was as a part of Cocoon 2.0.4. Have you tried
moving the
> file out of the way and having another go?

Yes, but the error keeps going on.. I'll check that later, and search a
little more deep for help on documentation...

Thanks for your help.


Joao Cesar,
joaocesar@duploclique.com

Computer Science Student's @ University of Lisboa, PORTUGAL



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


Re: SourceWrite error :|

Posted by Upayavira <uv...@upaya.co.uk>.
> No effect :(

Oh well.
 
> Perhaps we could use source:insert instead, we've tried but we get an
> XML output of what we wanted to insert, and no changes on the file :|

No, that is syntax for 2.1 AFAIK, not 2.0.4. You need <source:write src="..."> as 
you had.
 
> There are no working examples on the documentation, just a scratchpad
> that we already tested with no results also...

Are you using 2.0.4?

> Why are we figuring that altought may appear easy to work with cocoon,
> everytime we atempt to do something simple there's always some problem
> :( And the documentation never tells all the options and tags
> available like the one you just gave us :(

Believe me, it does get easier as you get used to how to work with Cocoon. And 
there are discussions going on at the moment about how to improve 
documentation for people like yourself...check out the Wiki (wiki.cocoondev.org).
 
> Is there any other transformer to write to a file?

I've had it working, so it is possible.

I used the sample that was as a part of Cocoon 2.0.4. Have you tried moving the 
file out of the way and having another go?

Upayavira



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


Re: SourceWrite error :|

Posted by João César <jo...@duploclique.com>.
No effect :(

Perhaps we could use source:insert instead, we've tried but we get an XML
output of what we wanted to insert, and no changes on the file :|

There are no working examples on the documentation, just a scratchpad that
we already tested with no results also...

Why are we figuring that altought may appear easy to work with cocoon,
everytime we atempt to do something simple there's always some problem :(
And the documentation never tells all the options and tags available like
the one you just gave us :(

Is there any other transformer to write to a file?

Thanks

Joao Cesar
joaocesar@duploclique.com

Computer Science Student's @ University of Lisboa, PORTUGAL

----- Original Message -----
From: "Upayavira" <uv...@upaya.co.uk>
To: <co...@xml.apache.org>
Sent: Friday, April 04, 2003 5:02 PM
Subject: Re: SourceWrite error :|


Try adding  overwrite="true" into the <source:write> node. Not sure if that
is it, but it is
worth a try.

Upayavira

On 4 Apr 2003 at 16:53, João César wrote:

>
> Hi, first of all thanks for your prompt answer :)
>
> I've just changed to <source:write src="repository/my.xml"> and the
> error still remains, but after I analyse the XML displayed in the
> browser we see:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <page xmlns:source="http://apache.org/cocoon/source/1.0">
>    <source:write src="file:/C:/Program Files/Apache Group/Tomcat
> 4.1/webapps/cocoon/pubmed/repository/my.xml" action="none"
> result="failed" serializer="xml">The src attribute doesn't resolve to
> a writeable source and failed to cancel</source:write>
>  </page>
>
> And the file exist's on that computer directory.. Do we need to write
> something on the file for it to become "writable", or can it be empty?
>
> Thanks in advance
>
> Joao Cesar
> joaocesar@duploclique.com
>
>
>
>
> ----- Original Message -----
> From: "Upayavira" <uv...@upaya.co.uk>
> To: <co...@xml.apache.org>
> Sent: Friday, April 04, 2003 4:45 PM
> Subject: Re: SourceWrite error :|
>
>
> > > Hi all,
> > >
> > > We're getting this error on sourcewrite transformer:
> > >
> > > "The src attribute doesn't resolve to a writeable source and
> > > failed to cancel " ...
> > >    <source:write src="context://pubmed/repository/my.xml">
> > > ...
> >
> > The source you write to must be 'writable'. Obviously 'context:'
> > does not
> refer to a
> > source that is writable. If you wish to write to a file, try either
> > src="pubmed/repository/my.xml" or
> > src="file:/path/to/context/pubmed/repository/my.xml"
> >
> > This should work as file: is writable.
> >
> > Regards, Upayavira
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org For
> additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>



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



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


Re: SourceWrite error :|

Posted by Upayavira <uv...@upaya.co.uk>.
Try adding  overwrite="true" into the <source:write> node. Not sure if that is it, but it is 
worth a try.

Upayavira

On 4 Apr 2003 at 16:53, João César wrote:

> 
> Hi, first of all thanks for your prompt answer :)
> 
> I've just changed to <source:write src="repository/my.xml"> and the
> error still remains, but after I analyse the XML displayed in the
> browser we see:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <page xmlns:source="http://apache.org/cocoon/source/1.0">
>    <source:write src="file:/C:/Program Files/Apache Group/Tomcat
> 4.1/webapps/cocoon/pubmed/repository/my.xml" action="none"
> result="failed" serializer="xml">The src attribute doesn't resolve to
> a writeable source and failed to cancel</source:write>
>  </page>
> 
> And the file exist's on that computer directory.. Do we need to write
> something on the file for it to become "writable", or can it be empty?
> 
> Thanks in advance
> 
> Joao Cesar
> joaocesar@duploclique.com
> 
> 
> 
> 
> ----- Original Message -----
> From: "Upayavira" <uv...@upaya.co.uk>
> To: <co...@xml.apache.org>
> Sent: Friday, April 04, 2003 4:45 PM
> Subject: Re: SourceWrite error :|
> 
> 
> > > Hi all,
> > >
> > > We're getting this error on sourcewrite transformer:
> > >
> > > "The src attribute doesn't resolve to a writeable source and
> > > failed to cancel " ...
> > >    <source:write src="context://pubmed/repository/my.xml">
> > > ...
> >
> > The source you write to must be 'writable'. Obviously 'context:'
> > does not
> refer to a
> > source that is writable. If you wish to write to a file, try either
> > src="pubmed/repository/my.xml" or
> > src="file:/path/to/context/pubmed/repository/my.xml"
> >
> > This should work as file: is writable.
> >
> > Regards, Upayavira
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org For
> additional commands, e-mail: cocoon-users-help@xml.apache.org
> 
> 



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


Re: SourceWrite error :|

Posted by João César <jo...@duploclique.com>.
Hi, first of all thanks for your prompt answer :)

I've just changed to <source:write src="repository/my.xml"> and the error
still remains, but after I analyse the XML displayed in the browser we see:

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:source="http://apache.org/cocoon/source/1.0">
   <source:write src="file:/C:/Program Files/Apache Group/Tomcat
4.1/webapps/cocoon/pubmed/repository/my.xml" action="none" result="failed"
serializer="xml">The src attribute doesn't resolve to a writeable source and
failed to cancel</source:write>
 </page>

And the file exist's on that computer directory.. Do we need to write
something on the file for it to become "writable", or can it be empty?

Thanks in advance

Joao Cesar
joaocesar@duploclique.com




----- Original Message -----
From: "Upayavira" <uv...@upaya.co.uk>
To: <co...@xml.apache.org>
Sent: Friday, April 04, 2003 4:45 PM
Subject: Re: SourceWrite error :|


> > Hi all,
> >
> > We're getting this error on sourcewrite transformer:
> >
> > "The src attribute doesn't resolve to a writeable source and failed to
> > cancel "
> > ...
> >    <source:write src="context://pubmed/repository/my.xml">
> > ...
>
> The source you write to must be 'writable'. Obviously 'context:' does not
refer to a
> source that is writable. If you wish to write to a file, try either
> src="pubmed/repository/my.xml" or
> src="file:/path/to/context/pubmed/repository/my.xml"
>
> This should work as file: is writable.
>
> Regards, Upayavira
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>



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


Re: SourceWrite error :|

Posted by Upayavira <uv...@upaya.co.uk>.
> Hi all,
> 
> We're getting this error on sourcewrite transformer:
> 
> "The src attribute doesn't resolve to a writeable source and failed to
> cancel "
> ...
>    <source:write src="context://pubmed/repository/my.xml">
> ...

The source you write to must be 'writable'. Obviously 'context:' does not refer to a 
source that is writable. If you wish to write to a file, try either 
src="pubmed/repository/my.xml" or 
src="file:/path/to/context/pubmed/repository/my.xml"

This should work as file: is writable.

Regards, Upayavira


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