Re: XMLHTTP and cocoon [site map how to]

2002-10-14 Thread Ugo Cei

Cocoon User wrote:
> i have succesfull write a js that create an xmlobject and then post it
> using xmlhttp
> 
> i have too succesfull post this xml stream to .php and java servlet .
> server side i just echo this stream and return this echo to js
> 
> 
> how can i modify sitemap to make cocoon ready to receive this stream and
> send a
> responce back to js.
> 
> thanks
> stavros s. kounis

Use a Stream Generator:


   
   
   
   


Ugo


-- 
Ugo Cei - http://www.beblogging.com/blog/


-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




RE: XMLHTTP and cocoon [site map how to]

2002-10-13 Thread Cocoon User


i have succesfull write a js that create an xmlobject and then post it
using xmlhttp

i have too succesfull post this xml stream to .php and java servlet .
server side i just echo this stream and return this echo to js


how can i modify sitemap to make cocoon ready to receive this stream and
send a
responce back to js.

thanks
stavros s. kounis




On Tue, 1 Oct 2002, Giuseppe Bonelli wrote:

> Kounis,
> you have to insert the js snippet in a function and attach the function to whatever 
>event you want. baseurl is a variable containing the url pointing to the pattern="foo/bar"> in the cocoon sitemap.
>
> The data flow is as follow:
> 1. a browser event triggers the js function
> 2. the js function send the xml data to the cocoon sitemap
> 3. the cocoon sitemap process the xml file through a source write transformer
> 4. the cocoon map returns to the browser a status message (and eventually other 
>generated xml)
> 5. the js function exits
>
> Your mileage may vary, but the principle is this.
>
> --peppo
>
> > -Original Message-
> > From: Cocoon User [mailto:[EMAIL PROTECTED]]
> > Sent: martedi 1 ottobre 2002 0.30
> > To: [EMAIL PROTECTED]
> > Subject: RE: XMLHTTP and cocoon [baseurl ?]
> >
> >
> >
> > thanx for the answer
> >
> > but can u give me an axample how to call this cocoon patern
> >
> > what's the baseurl?
> >
> >
> >
> >
> > On Mon, 30 Sep 2002, Giuseppe Bonelli wrote:
> >
> > > Here are a few snippets i use to exchange xml data from a
> > client side js and cocoon2.
> > >
> > > My scenario is: the client browser save an xml file on the
> > server using the source write transformer.
> > >
> > > If you need to echo the file back to the browser, just
> > serialize it again, eventually after another transformation.
> > >
> > > Hope this helps
> > >
> > > --peppo
> > >
> > > The client side js snippet:
> > >
> > >   {
> > >   ...
> > >   reqxml=the-xml-you-want-to-transfer-to-cocoon
> > >   xmlhttp.open("POST", baseurl, false);
> > >   xmlhttp.send(reqxml);
> > >   var resxml=xmlhttp.responseXML;
> > >   //alert(resxml.xml);
> > >   if (!reqxml.documentElement) {
> > >   alert("could not
> > parse:\n\n"+xmlhttp.responseText);
> > >   return null;
> > >   }
> > >
> > > // C2 error handling
> > >   try {
> > >   //check the response status
> > >   var buf=resxml.documentElement;
> > >
> > //alert(buf.childNodes.item(0).getAttribute("result"));
> > >   if
> > (buf.childNodes.item(0).getAttribute("result") != "success") {
> > >   var errmsg =
> > resxml.documentElement.text;
> > >   if (!ignoreErrors)
> > alert("Non e stato possibile salvare sul server il file.\n\n Il
> > server ha risposto: "+errmsg);
> > >   return null;
> > >   }
> > >   else {
> > >   var
> > fname=resxml.documentElement.childNodes.item(0).getAttribute("src");
> > >   var
> > pos=fname.indexOf('xdocs/');
> > >
> > fname=fname.slice(pos+6,fname.length-18);
> > >   alert("Una nuova
> > versione del file '"+fname+".xml' e stata salvata con successo
> > sul server\n\nBuona continuazione!");
> > >   }
> > >           } catch (e) {
> > >   if (!ignoreErrors)
> > alert("Server returned an error, but was not understood by the
> > editor.\n\n");
> > >   return null;
> > >   }
> > > },
> > >
> > > in the sitemap:
> > >
> > >   
> > > 
> > > 
> > > 
> > >   
> > >
> > > NB: the error handlin

RE: XMLHTTP and cocoon [baseurl ?]

2002-10-02 Thread Giuseppe Bonelli

Kounis,
you have to insert the js snippet in a function and attach the function to whatever 
event you want. baseurl is a variable containing the url pointing to the  in the cocoon sitemap.

The data flow is as follow: 
1. a browser event triggers the js function
2. the js function send the xml data to the cocoon sitemap
3. the cocoon sitemap process the xml file through a source write transformer
4. the cocoon map returns to the browser a status message (and eventually other 
generated xml)
5. the js function exits

Your mileage may vary, but the principle is this.

--peppo 

> -Original Message-
> From: Cocoon User [mailto:[EMAIL PROTECTED]]
> Sent: martedi 1 ottobre 2002 0.30
> To: [EMAIL PROTECTED]
> Subject: RE: XMLHTTP and cocoon [baseurl ?]
> 
> 
> 
> thanx for the answer
> 
> but can u give me an axample how to call this cocoon patern
> 
> what's the baseurl?
> 
> 
> 
> 
> On Mon, 30 Sep 2002, Giuseppe Bonelli wrote:
> 
> > Here are a few snippets i use to exchange xml data from a 
> client side js and cocoon2.
> >
> > My scenario is: the client browser save an xml file on the 
> server using the source write transformer.
> >
> > If you need to echo the file back to the browser, just 
> serialize it again, eventually after another transformation.
> >
> > Hope this helps
> >
> > --peppo
> >
> > The client side js snippet:
> >
> > {
> > ...
> > reqxml=the-xml-you-want-to-transfer-to-cocoon
> > xmlhttp.open("POST", baseurl, false);
> > xmlhttp.send(reqxml);
> > var resxml=xmlhttp.responseXML;
> > //alert(resxml.xml);
> > if (!reqxml.documentElement) {
> > alert("could not 
> parse:\n\n"+xmlhttp.responseText);
> > return null;
> > }
> >
> >   // C2 error handling
> > try {
> > //check the response status
> > var buf=resxml.documentElement;
> > 
> //alert(buf.childNodes.item(0).getAttribute("result"));
> > if 
> (buf.childNodes.item(0).getAttribute("result") != "success") {
> > var errmsg = 
> resxml.documentElement.text;
> > if (!ignoreErrors) 
> alert("Non e stato possibile salvare sul server il file.\n\n Il 
> server ha risposto: "+errmsg);
> > return null;
> > }
> > else {
> > var 
> fname=resxml.documentElement.childNodes.item(0).getAttribute("src");
> > var 
> pos=fname.indexOf('xdocs/');
> > 
> fname=fname.slice(pos+6,fname.length-18);
> > alert("Una nuova 
> versione del file '"+fname+".xml' e stata salvata con successo 
> sul server\n\nBuona continuazione!");
> > }
> > } catch (e) {
> > if (!ignoreErrors) 
> alert("Server returned an error, but was not understood by the 
> editor.\n\n");
> >     return null;
> > }
> > },
> >
> > in the sitemap:
> >
> >   
> > 
> > 
> > 
> >   
> >
> > NB: the error handling is done on the basis of the xml 
> generated by the source write transformer used in the sitemap. 
> See the docs for details.
> >
> >
> > > -Original Message-
> > > From: Cocoon User [mailto:[EMAIL PROTECTED]]
> > > Sent: lunedi 30 settembre 2002 11.21
> > > To: [EMAIL PROTECTED]
> > > Subject: XMLHTTP and cocoon
> > >
> > >
> > > hi folks
> > >
> > > i have make an html form than post an XML file (object with 
> javascript)
> > > using XMLHTTP
> > >
> > > is there any way in cocoon to receive this post an simple 
> echo this XML
> > > object in browser?
> > >
> > > (if not cocoon a tomcat webapp)
>

RE: XMLHTTP and cocoon [baseurl ?]

2002-09-30 Thread Cocoon User


thanx for the answer

but can u give me an axample how to call this cocoon patern

what's the baseurl?




On Mon, 30 Sep 2002, Giuseppe Bonelli wrote:

> Here are a few snippets i use to exchange xml data from a client side js and cocoon2.
>
> My scenario is: the client browser save an xml file on the server using the source 
>write transformer.
>
> If you need to echo the file back to the browser, just serialize it again, 
>eventually after another transformation.
>
> Hope this helps
>
> --peppo
>
> The client side js snippet:
>
>   {
>   ...
>   reqxml=the-xml-you-want-to-transfer-to-cocoon
>   xmlhttp.open("POST", baseurl, false);
>   xmlhttp.send(reqxml);
>   var resxml=xmlhttp.responseXML;
>   //alert(resxml.xml);
>   if (!reqxml.documentElement) {
>   alert("could not 
>parse:\n\n"+xmlhttp.responseText);
>   return null;
>   }
>
> // C2 error handling
>   try {
>   //check the response status
>   var buf=resxml.documentElement;
>   
>//alert(buf.childNodes.item(0).getAttribute("result"));
>   if 
>(buf.childNodes.item(0).getAttribute("result") != "success") {
>   var errmsg = 
>resxml.documentElement.text;
>   if (!ignoreErrors) alert("Non e stato 
>possibile salvare sul server il file.\n\n Il server ha risposto: "+errmsg);
>   return null;
>   }
>   else {
>   var 
>fname=resxml.documentElement.childNodes.item(0).getAttribute("src");
>   var pos=fname.indexOf('xdocs/');
>   
>fname=fname.slice(pos+6,fname.length-18);
>   alert("Una nuova versione del file 
>'"+fname+".xml' e stata salvata con successo sul server\n\nBuona continuazione!");
>   }
>   } catch (e) {
>   if (!ignoreErrors) alert("Server returned an 
>error, but was not understood by the editor.\n\n");
>   return null;
>   }
> },
>
> in the sitemap:
>
>   
> 
> 
> 
>   
>
> NB: the error handling is done on the basis of the xml generated by the source write 
>transformer used in the sitemap. See the docs for details.
>
>
> > -Original Message-
> > From: Cocoon User [mailto:[EMAIL PROTECTED]]
> > Sent: lunedi 30 settembre 2002 11.21
> > To: [EMAIL PROTECTED]
> > Subject: XMLHTTP and cocoon
> >
> >
> > hi folks
> >
> > i have make an html form than post an XML file (object with javascript)
> > using XMLHTTP
> >
> > is there any way in cocoon to receive this post an simple echo this XML
> > object in browser?
> >
> > (if not cocoon a tomcat webapp)
> >
> > i want to find a very simple example to test if i can transport an XML
> > object from a client (IE6) to the server where a cocoon and tomcat are
> > installed
> >
> >
> > thnx
> >
> > Kounis Stavros
> >
> >
> >
> >
> >
> >
> > -
> > Please check that your question  has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > For additional commands, e-mail:   <[EMAIL PROTECTED]>
> >
> >
>
>
> -
> Please check that your question  has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>
>
>


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

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




RE: XMLHTTP and cocoon

2002-09-30 Thread Giuseppe Bonelli

Here are a few snippets i use to exchange xml data from a client side js and cocoon2.

My scenario is: the client browser save an xml file on the server using the source 
write transformer.

If you need to echo the file back to the browser, just serialize it again, eventually 
after another transformation.

Hope this helps

--peppo
 
The client side js snippet:

{
...
reqxml=the-xml-you-want-to-transfer-to-cocoon
xmlhttp.open("POST", baseurl, false);
xmlhttp.send(reqxml);
var resxml=xmlhttp.responseXML;
//alert(resxml.xml);
if (!reqxml.documentElement) {
alert("could not 
parse:\n\n"+xmlhttp.responseText);
return null;
}

  // C2 error handling
try {
//check the response status
var buf=resxml.documentElement;

//alert(buf.childNodes.item(0).getAttribute("result"));
if 
(buf.childNodes.item(0).getAttribute("result") != "success") {
var errmsg = 
resxml.documentElement.text;
if (!ignoreErrors) alert("Non e stato 
possibile salvare sul server il file.\n\n Il server ha risposto: "+errmsg);
return null;
}
else {
var 
fname=resxml.documentElement.childNodes.item(0).getAttribute("src");
var pos=fname.indexOf('xdocs/');

fname=fname.slice(pos+6,fname.length-18);
alert("Una nuova versione del file 
'"+fname+".xml' e stata salvata con successo sul server\n\nBuona continuazione!");
}
} catch (e) {
if (!ignoreErrors) alert("Server returned an 
error, but was not understood by the editor.\n\n");
return null;
}
},

in the sitemap:

  



  

NB: the error handling is done on the basis of the xml generated by the source write 
transformer used in the sitemap. See the docs for details.


> -Original Message-
> From: Cocoon User [mailto:[EMAIL PROTECTED]]
> Sent: lunedi 30 settembre 2002 11.21
> To: [EMAIL PROTECTED]
> Subject: XMLHTTP and cocoon
> 
> 
> hi folks
> 
> i have make an html form than post an XML file (object with javascript)
> using XMLHTTP
> 
> is there any way in cocoon to receive this post an simple echo this XML
> object in browser?
> 
> (if not cocoon a tomcat webapp)
> 
> i want to find a very simple example to test if i can transport an XML
> object from a client (IE6) to the server where a cocoon and tomcat are
> installed
> 
> 
> thnx
> 
> Kounis Stavros
> 
> 
> 
> 
> 
> 
> -
> Please check that your question  has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>
> 
> 


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

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




RE: XMLHTTP and cocoon

2002-09-30 Thread JohnsBrn

I'm not that familiar with XMLHTTP, but you can echo back the input of any cocoon 
stream by placing an xml serializer after the generator. If, for instance, you were 
using the 2.0.3 StreamGenerator to post the data, your pipeline would look like this:


 
 



Cocoon User <[EMAIL PROTECTED]> wrote:

>hi folks
>
>i have make an html form than post an XML file (object with javascript)
>using XMLHTTP
>
>is there any way in cocoon to receive this post an simple echo this XML
>object in browser?
>
>(if not cocoon a tomcat webapp)
>
>i want to find a very simple example to test if i can transport an XML
>object from a client (IE6) to the server where a cocoon and tomcat are
>installed
>
>
>thnx
>
>Kounis Stavros
>
>
>
>
>
>
>-
>Please check that your question  has not already been answered in the
>FAQ before posting. 
>
>To unsubscribe, e-mail: <[EMAIL PROTECTED]>
>For additional commands, e-mail:   <[EMAIL PROTECTED]>
>
>

__
The NEW Netscape 7.0 browser is now available. Upgrade now! 
http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




XMLHTTP and cocoon

2002-09-30 Thread Cocoon User

hi folks

i have make an html form than post an XML file (object with javascript)
using XMLHTTP

is there any way in cocoon to receive this post an simple echo this XML
object in browser?

(if not cocoon a tomcat webapp)

i want to find a very simple example to test if i can transport an XML
object from a client (IE6) to the server where a cocoon and tomcat are
installed


thnx

Kounis Stavros






-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>