You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by christian bindeballe <ot...@gmail.com> on 2006/01/20 15:51:19 UTC

adding data to a file, per flow?

hello list.

I have the following setup.

I have a form and the data entered into that form is saved to a file. 
this is done using the bindings_example.js and the form2simpleXML example.
each time someone enters data into the form and submits it, this data is 
written to a file. what I want, is a second file, that has as elements 
the data from the form, as in this:

<entries>
	<entry>widget data from a 1st submit</entry>
	<entry>widget data from a 2nd submit</entry>
	<entry>widget data from a 3rd submit</entry>

</entries>

so I would have the file that contains the submitted data not be renamed 
but overwritten every time someone submits data. how can I accomplish 
that the submitted data is not just written to one file but also that 
this data (from the file) is appended to the other file (as the one 
described above)?
for example I would call a pipeline after writing the widget data to the 
file, that would have a SourceWrite Transformer in it that appends the 
widget-data to the list-file. but that means that I have to have the 
<source:insert>- and other tags in the file that contains the original 
form data. that to me seems impossible because I don't know where and 
how I could put it in a definition file without getting errors on 
calling the form. putting it in the template also does not make the 
<source:insert> - stuff be included in the saved widget data :(

does someone know how I could do the above? maybe I am missing 
something, but it seems to me as if it shouldn't be so difficult, but I 
cannot think of a way to make this work. also, I hope that I could make 
myself clear with what I want to achieve...

best regards,

christian

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


Re: adding data to a file, per flow?

Posted by christian bindeballe <ot...@gmail.com>.
ok, a little thinking and a lot of time later I finally figured out, how
to do it :)

first I have the form-result-file. this is what it looks like:

<?xml version="1.0" encoding="UTF-8"?>
<eintrag>
	<lehrkraft>Hr. Prof. U.N. Sinn</lehrkraft>
	<ausfall-von>1/27/06</ausfall-von>
	<ausfall-bis>1/29/06</ausfall-bis>
</eintrag>

using the CIncludeTransformer I pull the content of this file into
another file that has the <source:insert>-tags in it which I need to
write to a file. it looks like this:

<page>
   <source:insert xmlns:source="http://apache.org/cocoon/source/1.0"
xmlns:cinclude="http://apache.org/cocoon/include/1.0">
      <source:source>lehrkraftnews.xml</source:source>
      <source:path>lkn</source:path>
      <source:fragment>
      	<cinclude:include src="lkn-result.xml"/>
      </source:fragment>
    </source:insert>
  </page>

these tags have as a child element the <cinclude:include>-tag so that
the data is inserted correctly. so, I first call the
cinclude-transformer to put the data in there, then the
source-write-transformer in order to save to lehrkraftnews.xml.
just the way I needed it. the only thing that bothers me is the output
generated by the source-write-transformer after it finishes the
operation. something like: "write success to foo.bar.xml xml" anybody
know where to turn this off?

regards,

christian


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