You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Chitharanjan Das <cd...@accordiasys.com> on 2002/02/15 05:05:43 UTC

RE: writing xml to file - Solution

Approach 1:

Why don't you modify the existing Xml serializer  to write it to the
disk and return a OK or a failure message?

You have the handle to the output stream anyways...
 Haven't tried it but do let us know..

Approach 2:
	I have created a new Transformer (AbstractStringTransformer ,
StringTransformer is an implementation of AbstractStringTransformer),
which basically captures the XML as a String and invokes a method where
you would embed ur custom logic 


//SiteMap entries
//Transformer defn
<map:transformer     name="str-trans"
src="com.accordia.display.transformation.StringTransformer"/>

//pattern match entry in pipeline
  <map:match pattern="str-trans">
     <map:generate src="docs/samples/xml/samples.xml">
      	<map:parameter name="xml-root" value="samples"/>
     </map:generate>	
     <map:transform type="str-trans" />
     <map:serialize type="html"/> <!-- not xml serializer -->
   </map:match>


public String process(String element, String xmlData) {
}

You can get access to your context, request (Since this is a
transformer) and write code in this method to store the XML file and
return a message (OK or failure)

If U like the approach, do let me know


I will send U the source code ....

Cheers,
Chiths


-----Original Message-----
From: Erik Stunkat [mailto:Erik.Stunkat@poet.de] 
Sent: Thursday, February 14, 2002 6:05 AM
To: cocoon-users@xml.apache.org
Subject: Re: writing xml to file



Hi Bert,

I´m really interested in editing xml files in a browser - I tried to use
Chiba for that but I couldn´t get it in the way I want it.

Why not use XSL and fp:write: to write XML docs? I´m not sure whether it
works with Cocoon 2


cu

erik


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>





---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: writing xml to file - Solution

Posted by Bert Van Kets <be...@visitronics.be>.
I like the idea of the serialiser.  I will be using it a lot since I'm 
creating a framework to let people access the content of the site through a 
browser.  Please do send me the code.  Thanks.
I just have to figure out how to send through the exact filename.  Since 
this has to be a local path on the server I'm no really sure how to get 
it.  Any ideas?
Bert

>Approach 2:
>         I have created a new Transformer (AbstractStringTransformer ,
>StringTransformer is an implementation of AbstractStringTransformer),
>which basically captures the XML as a String and invokes a method where
>you would embed ur custom logic
>
>
>//SiteMap entries
>//Transformer defn
><map:transformer     name="str-trans"
>src="com.accordia.display.transformation.StringTransformer"/>
>
>//pattern match entry in pipeline
>   <map:match pattern="str-trans">
>      <map:generate src="docs/samples/xml/samples.xml">
>         <map:parameter name="xml-root" value="samples"/>
>      </map:generate>
>      <map:transform type="str-trans" />
>      <map:serialize type="html"/> <!-- not xml serializer -->
>    </map:match>
>
>
>public String process(String element, String xmlData) {
>}
>
>You can get access to your context, request (Since this is a
>transformer) and write code in this method to store the XML file and
>return a message (OK or failure)
>
>If U like the approach, do let me know
>
>
>I will send U the source code ....
>
>Cheers,
>Chiths


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>