Re: JavaScript problems in XSP
Hi Geoff. Thanks for helping me. If you don't mind, I want to ask you some more questions, cause I still don't really understand what I have to do. 1. I didin't find any example of xsp using Rhino. Can you give me an example, or a URL to the page with example? I am sorry, but I tried hard to find examples, and I just didn't succeed. In Cocoon documentation it is mentioned that Rhino can be used as an XSP scripting language, but they don't give any example. 2. Can I use JSGenerator instead of ServerPagesGenerator on the pipeline? All these things confuse me alot, and I'll be very happy if you gave me some more clues. Thank you very very much and sorry for attacking you with so many questions. Anna - Original Message - From: Geoff Howard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 12:14 AM Subject: Re: JavaScript problems in XSP Ugh. This may spell bad news: see inline comments. If you are comfortable in java as well as javascript (at least reasonably so) you may want to look into using a java based javascript interpreter - looking into the cocoon javascript generator (org.apache.cocoon.components.language.markup.xsp.JSGenerator) and other JS related sources around there in the source tree it looks like cocoon is using Rhino (http://www.mozilla.org/rhino/). Then, you can write your xsp in java (which has far more features and users) but still execute arbitrary javascript code when you find it. That said, I think you're on a potentially very confusing path because of all the places javascript can be in an html page, and all the DOM objects it's likely to reference. Still, this may work and I'd be very interested to hear how it goes and help as I can - but I've never touched Rhino and can't right now. Geoff (more comments below) --- Anna Afonchenko [EMAIL PROTECTED] wrote: 1. First of all I tried to give the eval() function some simple string that I declared inside the xsp:logic tag: someStr = document.write('centerHello/center'); If I write this string inside the xsp:exprdocument.text/xsp:expr, the output is: ?xml version=1.0 encoding=UTF-8 ? page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-request=http://apache.org/xsp/request/2.0; xmlns:util=http://apache.org/xsp/util/2.0; pcenterHello/center/p /page which is great, but when I looked in the source code, I found out that the centerHello/center string is written using entities, e.g. it is not a node-set of the output xml document. Right, sorry about that. I had seen in another email that you were using util:include-expr so I left that part out for simplicity but forgot to comment as such. Trying to enclose the xsp:expr tag inside the util:include-expr tag: util:include-exprutil:exprxsp:exprdocument.text/xsp:expr/util:expr /util:include-expr the surprising output is: ?xml version=1.0 encoding=UTF-8 ? page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-request=http://apache.org/xsp/request/2.0; xmlns:util=http://apache.org/xsp/util/2.0; p util:include-expr util:exprcenterHello/center/util:expr /util:include-expr /p /page This is strange. Do you have any idea how can I avoid outputting the result as a string (with entities) rather that outputting it as a node-set? Not surprising - just checked and javascript xsp's have only request, response and session logicsheets. I don't know if it's possible to recreate the include expression functionality in javascript - you may want to send a very specific question on that to this list, making clear that you know it doesn't yet exist. 2. How can I retrieve the content of some html file from xsp with javascript? I don't know if you can - you can't from a browser, but that may be only because of the security limitations imposed. And parse it? See above. Is it possible that there are problem using util library from xsp with javascript? Right. It doesn't exist in javascript. Geoff __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com - 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: JavaScript problems in XSP
--- Anna Afonchenko [EMAIL PROTECTED] wrote: Hi Geoff. Thanks for helping me. If you don't mind, I want to ask you some more questions, cause I still don't really understand what I have to do. 1. I didin't find any example of xsp using Rhino. You just need examples of java using rhino. I was recommending changing to regular java xsp. You'll need to use xsp:structure and xsp:include to make sure the rhino classes you need are available in your xsp and then later on in xsp:logic you can do anything you would in a normal java class (because when cocoon is done with your xsp file, it _will_ be a normal java class. If you haven't gone to look for the .java source files that cocoon generates out of your xsp (probably under tomcat's work/ directory) you really should. It would take some of the mystery out of xsp. Rhino is a javascript interpreter/engine (whatever). So within your xsp now written in java, you'll retrieve your html page, pass on any regular tags, and then pass the contents of the script tags to the rhino instance. To be very clear: I have no idea if this is feasible and if you're not very comfortable in java, the chances are slim you'll get this working without more help than I or probably anyone else on the list can provide. I'm just suggesting an avenue to try. Can you give me an example, or a URL to the page with example? I am sorry, but I tried hard to find examples, and I just didn't succeed. I highly doubt that any examples exist of doing exactly what you are trying. In Cocoon documentation it is mentioned that Rhino can be used as an XSP scripting language, but they don't give any example. They do - what they're talking about is xsp-js though. I'm suggesting you abandon xsp-js because of some of the other things you need to do, and call the same java-based javascript interpreter directly from your java class (which xsp just helps you create.) 2. Can I use JSGenerator instead of ServerPagesGenerator on the pipeline? That's happening automatically when you declare that your xsp's are written in javascript. But you probably don't want to do that anymore. The only reason you ever needed xsp-js was because it gave you access to the Rhino javscript stuff behind the scenes. But it took away your ability to use the java stuff you need. All these things confuse me alot, and I'll be very happy if you gave me some more clues. Thank you very very much and sorry for attacking you with so many questions. Anna I can appreciate how confusing this must all seem to someone new to cocoon, and even worse if you're new to java - I'm sure all this just seems like absolute voodoo. Unfortunately, all I can give is clues because my own time is limited and because you're trying something fairly novel. Best of luck, Geoff PS, it's a holiday later this week in the states, so I may be off list for a while. - Original Message - From: Geoff Howard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 12:14 AM Subject: Re: JavaScript problems in XSP Ugh. This may spell bad news: see inline comments. If you are comfortable in java as well as javascript (at least reasonably so) you may want to look into using a java based javascript interpreter - looking into the cocoon javascript generator (org.apache.cocoon.components.language.markup.xsp.JSGenerator) and other JS related sources around there in the source tree it looks like cocoon is using Rhino (http://www.mozilla.org/rhino/). Then, you can write your xsp in java (which has far more features and users) but still execute arbitrary javascript code when you find it. That said, I think you're on a potentially very confusing path because of all the places javascript can be in an html page, and all the DOM objects it's likely to reference. Still, this may work and I'd be very interested to hear how it goes and help as I can - but I've never touched Rhino and can't right now. Geoff (more comments below) --- Anna Afonchenko [EMAIL PROTECTED] wrote: 1. First of all I tried to give the eval() function some simple string that I declared inside the xsp:logic tag: someStr = document.write('centerHello/center'); If I write this string inside the xsp:exprdocument.text/xsp:expr, the output is: ?xml version=1.0 encoding=UTF-8 ? page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-request=http://apache.org/xsp/request/2.0; xmlns:util=http://apache.org/xsp/util/2.0; pcenterHello/center/p /page which is great, but when I looked in the source code, I found out that the centerHello/center string is written using entities, e.g. it is not a node-set of the output xml document. Right, sorry about that. I had seen in another email that you were using util:include-expr so I left that part out for simplicity but forgot to comment as such. Trying to enclose the xsp:expr tag inside the util:include-expr tag
Re: Javascript problems in XSP
hey that's neat! - 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: Javascript problems in XSP
What do you mean by neat? Sorry if this is an unrelated question - Original Message - From: Jacob L E Blain Christen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 10:23 PM Subject: Re: Javascript problems in XSP hey that's neat! - 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: JavaScript problems in XSP
I am not using document.write. What I am trying to do is load some arbitrary file from the net (not my file, just any file, so I don't have control on what's written inside) and if this file contains script tag (which is written, for example, in Javascript), I want to extract the HTML tree fragment that is generated by this (Java)script. I use xsp to include the given file, that's all, then I use xsl to extract the data inside the script tags. But what I get is again the script code, e.g. document.write(centerHello/center); What I'm asking is whether it's possible to extract the HTML that the script is writing - in this case it's just to get the value of the document.write method, but it can be something more complicated. I don't know if this can be done at all, in Cocoon/XSP/XSL. If somebody will have any idea how to do it, I will be very thankful. Sorry if this is too messy, I am new to this list and to cocoon at all. Thank you for all the help. Anna - Original Message - From: Geoff Howard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 24, 2002 4:54 PM Subject: Re: JavaScript problems in XSP Why are you using document.write? document of course is a reference to the client side document object which doesn't exist server side at all. The problem with your example is that you don't need javascript (or xsp for that matter) to do any of that. Obviously you want to move beyond that though. It's also unclear whether you want that fragment to be included in the sax stream, or whether you want that output escaped and displayed as is on screen (i think the first). I'm not sure you can (using javascript in xsp) easily take an xml fragment in string form and generate sax events from it. It doesn't matter though because you probably really don't need to. What you should probably do is start with (note the ... implies that you probably have other page structure but you don't need to for this example) xsp:page language=javascript xmlns:xsp=http://apache.org/xsp; ... center font size=+3 This HTML-document has been created with the help of JavaScript! /font /center ... /xsp:page And then use xsp:logic xsp:expr xsp:attribute xsp:element etc to make whatever parts dynamic. For example, a next step might be : xsp:page language=javascript xmlns:xsp=http://apache.org/xsp; ... xsp:logic message = This HTML-document has been created with the help of JavaScript!; /xsp:logic center font size=+3 xsp:exprmessage/xsp:expr /font /center ... /xsp:page and then, xsp:page language=javascript xmlns:xsp=http://apache.org/xsp; ... xsp:logic message = This HTML-document has been created with the help of JavaScript!; displayMessage = true; /xsp:logic ... xsp:logic if (displayMessage) { center font size=+3 xsp:exprmessage/xsp:expr /font /center } /xsp:logic ... /xsp:page The best place I know of to read up on the xsp sytax is http://outerthought.net/wiki/Wiki.jsp?page=XSPSyntax as the official docs don't catalog the available tags IIRC. If you don't mind me saying so, I'd also suggest that you read up some more on the basic ideas behind the cocoon sax pipeline concept and what generators do as it seems you may have some of the concepts muddled. XSP is only a tool for automatically creating a generator - a compiled java class no matter what language you script your xsp in. Best of luck, Geoff Howard --- Anna Afonchenko [EMAIL PROTECTED] wrote: Thank you Ryan. Now what I get when I run the pipeline, what I see is the result of running the javascript. But what I really need is the source of this javascript, e.g. if the javascript code was: document.write(centerfont size=+3); document.write(This HTML-document has been created ); document.write(with the help of JavaScript!); document.write(/font/center); I want to get as a result the xhtml tree fragment that is created, e.g. I want to get back: center font size=+3 This HTML-document has been created with the help of JavaScript! /font /center e.g. I want to see the actual HTML code that was used in javascript to create the given page, and not the result of executing it. Is it doable in Cocoon/XSP? Thank you very much for your help. Anna - Original Message - From: Ryan Agler [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 21, 2002 4:26 PM Subject: RE: JavaScript problems in XSP Hi Anna, Client-side (in your web browser) JavaScript is a completely different beast than server-side (on your web server) JavaScript. In server-side JavaScript, there are no windows, DHTML, or much any other properties or methods you would use to manipulate a browser for dynamic content. To use Cocoon to achieve your task, the first step would to define given-file.html in your sitemap, and make sure its serialized in well-formed XHTML. Then you could use the Cinclude transformer to import given-file.html, kind of like
RE: JavaScript problems in XSP
Hi Geoff, I know, that maybe will not help you, but normally you won't write JavaScript in your xsp, you should do it in your stylesheet and you will avoid many problems... :-) Best regards - Volker - -Original Message- From: Geoff Howard [mailto:[EMAIL PROTECTED]] Sent: Montag, 25. November 2002 14:30 To: [EMAIL PROTECTED] Subject: Re: JavaScript problems in XSP Aha. For future reference, you probably should have made it clear from the beginning that you were a) using javascript xsp, and b) trying to do this specific thing with retrieving external pages out of your control. That said, you are probably in uncharted waters - but interesting ones. The first thing I'd try is make sure that this ability doesn't already exist by some miracle in JTidy or another html parser. I'd suggest trying the following (but you have to promise to let me know whether it works or not). What about tricking the client side javascript into evaluating the document.write and document.writeln? For instance, set up a javascript object called document which initializes an empty text holder and exposes a write() and writeln() method to append to that variable. Then, use eval() on each line taken out of your script tags. So, function write(string) {this.text += string;} function writeln(string) {this.text += (string + '\n')}; function doc() { this.text=; this.write = write; this.writeln = writeln; } then when you encounter a script section do something like: xsp:logic var document = new doc(); eval('document.writeln...); eval('document.write...); /xsp:logic xsp:exprdocument.text/xsp:expr where you take each string to eval out of the incoming script section, probably in a for loop. any other variables and operations it uses to prepare values should work the same as normal. You'll have trouble with escaping quotes, and extracting the strings but it may be possible. Other than that, I'm out of ideas. You may not be able to do this at all in a way that is worth the effort. Geoff --- Anna Afonchenko [EMAIL PROTECTED] wrote: I am not using document.write. What I am trying to do is load some arbitrary file from the net (not my file, just any file, so I don't have control on what's written inside) and if this file contains script tag (which is written, for example, in Javascript), I want to extract the HTML tree fragment that is generated by this (Java)script. I use xsp to include the given file, that's all, then I use xsl to extract the data inside the script tags. But what I get is again the script code, e.g. document.write(centerHello/center); What I'm asking is whether it's possible to extract the HTML that the script is writing - in this case it's just to get the value of the document.write method, but it can be something more complicated. I don't know if this can be done at all, in Cocoon/XSP/XSL. If somebody will have any idea how to do it, I will be very thankful. Sorry if this is too messy, I am new to this list and to cocoon at all. Thank you for all the help. Anna - Original Message - From: Geoff Howard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 24, 2002 4:54 PM Subject: Re: JavaScript problems in XSP Why are you using document.write? document of course is a reference to the client side document object which doesn't exist server side at all. The problem with your example is that you don't need javascript (or xsp for that matter) to do any of that. Obviously you want to move beyond that though. It's also unclear whether you want that fragment to be included in the sax stream, or whether you want that output escaped and displayed as is on screen (i think the first). I'm not sure you can (using javascript in xsp) easily take an xml fragment in string form and generate sax events from it. It doesn't matter though because you probably really don't need to. What you should probably do is start with (note the ... implies that you probably have other page structure but you don't need to for this example) xsp:page language=javascript xmlns:xsp=http://apache.org/xsp; ... center font size=+3 This HTML-document has been created with the help of JavaScript! /font /center ... /xsp:page And then use xsp:logic xsp:expr xsp:attribute xsp:element etc to make whatever parts dynamic. For example, a next step might be : xsp:page language=javascript xmlns:xsp=http://apache.org/xsp; ... xsp:logic message = This HTML-document has been created with the help of JavaScript!; /xsp:logic center font size=+3 xsp:exprmessage/xsp:expr /font /center ... /xsp:page and then, xsp:page language=javascript xmlns:xsp=http://apache.org/xsp; ... xsp:logic message = This HTML-document has been created with the help of JavaScript!; displayMessage = true; /xsp:logic ... xsp:logic if (displayMessage) { center font size=+3 xsp:exprmessage/xsp:expr
Re: JavaScript problems in XSP
Hi Geoff. Thank you for your help, I appreciate this very much. I tried the code that you suggested, and I have a few questions/issues: 1. First of all I tried to give the eval() function some simple string that I declared inside the xsp:logic tag: someStr = document.write('centerHello/center'); If I write this string inside the xsp:exprdocument.text/xsp:expr, the output is: ?xml version=1.0 encoding=UTF-8 ? page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-request=http://apache.org/xsp/request/2.0; xmlns:util=http://apache.org/xsp/util/2.0; pcenterHello/center/p /page which is great, but when I looked in the source code, I found out that the centerHello/center string is written using entities, e.g. it is not a node-set of the output xml document. Trying to enclose the xsp:expr tag inside the util:include-expr tag: util:include-exprutil:exprxsp:exprdocument.text/xsp:expr/util:expr /util:include-expr the surprising output is: ?xml version=1.0 encoding=UTF-8 ? page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-request=http://apache.org/xsp/request/2.0; xmlns:util=http://apache.org/xsp/util/2.0; p util:include-expr util:exprcenterHello/center/util:expr /util:include-expr /p /page i.e. centerHello/center remains to be a string and not a node-set, but now it is enclosed in a tree fragment util:include-exprutil:expr. This is strange. Do you have any idea how can I avoid outputting the result as a string (with entities) rather that outputting it as a node-set? 2. How can I retrieve the content of some html file from xsp with javascript? And parse it? When I was using Java inside an xsp, i could write the following: XSPUtil u = new XSPUtil(); String get = u.getFileContents(URL of the file); Can I do something like this from Javascript? I tried: content = util:get-file-contents name=URL of the file; but it doesn't work. Is it possible that there are problem using util library from xsp with javascript? Thank you for your help. I will wait for your answer. I hope this is not too long. Grateful Anna - Original Message - From: Geoff Howard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 25, 2002 3:30 PM Subject: Re: JavaScript problems in XSP Aha. For future reference, you probably should have made it clear from the beginning that you were a) using javascript xsp, and b) trying to do this specific thing with retrieving external pages out of your control. That said, you are probably in uncharted waters - but interesting ones. The first thing I'd try is make sure that this ability doesn't already exist by some miracle in JTidy or another html parser. I'd suggest trying the following (but you have to promise to let me know whether it works or not). What about tricking the client side javascript into evaluating the document.write and document.writeln? For instance, set up a javascript object called document which initializes an empty text holder and exposes a write() and writeln() method to append to that variable. Then, use eval() on each line taken out of your script tags. So, function write(string) {this.text += string;} function writeln(string) {this.text += (string + '\n')}; function doc() { this.text=; this.write = write; this.writeln = writeln; } then when you encounter a script section do something like: xsp:logic var document = new doc(); eval('document.writeln...); eval('document.write...); /xsp:logic xsp:exprdocument.text/xsp:expr where you take each string to eval out of the incoming script section, probably in a for loop. any other variables and operations it uses to prepare values should work the same as normal. You'll have trouble with escaping quotes, and extracting the strings but it may be possible. Other than that, I'm out of ideas. You may not be able to do this at all in a way that is worth the effort. Geoff __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com - 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: JavaScript problems in XSP
Ugh. This may spell bad news: see inline comments. If you are comfortable in java as well as javascript (at least reasonably so) you may want to look into using a java based javascript interpreter - looking into the cocoon javascript generator (org.apache.cocoon.components.language.markup.xsp.JSGenerator) and other JS related sources around there in the source tree it looks like cocoon is using Rhino (http://www.mozilla.org/rhino/). Then, you can write your xsp in java (which has far more features and users) but still execute arbitrary javascript code when you find it. That said, I think you're on a potentially very confusing path because of all the places javascript can be in an html page, and all the DOM objects it's likely to reference. Still, this may work and I'd be very interested to hear how it goes and help as I can - but I've never touched Rhino and can't right now. Geoff (more comments below) --- Anna Afonchenko [EMAIL PROTECTED] wrote: 1. First of all I tried to give the eval() function some simple string that I declared inside the xsp:logic tag: someStr = document.write('centerHello/center'); If I write this string inside the xsp:exprdocument.text/xsp:expr, the output is: ?xml version=1.0 encoding=UTF-8 ? page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-request=http://apache.org/xsp/request/2.0; xmlns:util=http://apache.org/xsp/util/2.0; pcenterHello/center/p /page which is great, but when I looked in the source code, I found out that the centerHello/center string is written using entities, e.g. it is not a node-set of the output xml document. Right, sorry about that. I had seen in another email that you were using util:include-expr so I left that part out for simplicity but forgot to comment as such. Trying to enclose the xsp:expr tag inside the util:include-expr tag: util:include-exprutil:exprxsp:exprdocument.text/xsp:expr/util:expr /util:include-expr the surprising output is: ?xml version=1.0 encoding=UTF-8 ? page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-request=http://apache.org/xsp/request/2.0; xmlns:util=http://apache.org/xsp/util/2.0; p util:include-expr util:exprcenterHello/center/util:expr /util:include-expr /p /page This is strange. Do you have any idea how can I avoid outputting the result as a string (with entities) rather that outputting it as a node-set? Not surprising - just checked and javascript xsp's have only request, response and session logicsheets. I don't know if it's possible to recreate the include expression functionality in javascript - you may want to send a very specific question on that to this list, making clear that you know it doesn't yet exist. 2. How can I retrieve the content of some html file from xsp with javascript? I don't know if you can - you can't from a browser, but that may be only because of the security limitations imposed. And parse it? See above. Is it possible that there are problem using util library from xsp with javascript? Right. It doesn't exist in javascript. Geoff __ Do you Yahoo!? Yahoo! Mail Plus Powerful. Affordable. Sign up now. http://mailplus.yahoo.com - 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: JavaScript problems in XSP
Thank you Ryan. Now what I get when I run the pipeline, what I see is the result of running the javascript. But what I really need is the source of this javascript, e.g. if the javascript code was: document.write(centerfont size=+3); document.write(This HTML-document has been created ); document.write(with the help of JavaScript!); document.write(/font/center); I want to get as a result the xhtml tree fragment that is created, e.g. I want to get back: center font size=+3 This HTML-document has been created with the help of JavaScript! /font /center e.g. I want to see the actual HTML code that was used in javascript to create the given page, and not the result of executing it. Is it doable in Cocoon/XSP? Thank you very much for your help. Anna - Original Message - From: Ryan Agler [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 21, 2002 4:26 PM Subject: RE: JavaScript problems in XSP Hi Anna, Client-side (in your web browser) JavaScript is a completely different beast than server-side (on your web server) JavaScript. In server-side JavaScript, there are no windows, DHTML, or much any other properties or methods you would use to manipulate a browser for dynamic content. To use Cocoon to achieve your task, the first step would to define given-file.html in your sitemap, and make sure its serialized in well-formed XHTML. Then you could use the Cinclude transformer to import given-file.html, kind of like this (myfile.xsp): ?xml version=1.0? xsp:page language=java xmlns:xsp=http://apache.org/xsp page xmlns:cinclude=http://apache.org/cocoon/include/1.0; p cinclude:include src=cocoon:/given-file.html / /p /page /xsp:page and in your sitemap.xmap: map:match pattern=given-file.html map:generate type=serverpages src=docs/given-file.xsp / map:transform src=stylesheets/given-file.xsl / map:serialize type=xhtml/ /map:match map:match pattern=myfile.xsl map:generate type=serverpages src=docs/myfile.xsp / map:transform type=cinclude/ map:transform src=stylesheets/myfile.xsl / map:serialize / /map:match HTH +Ryan -Original Message- From: Anna Afonchenko [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 21, 2002 7:43 AM To: [EMAIL PROTECTED] Subject: Javascript problems in XSP Hi All. This is my first post, so don't be angry with me if I do something wrong. I am using XSP on Cocoon 2.0.3, and I want to do the following: given a name of the html file that contains javascript, I want to get the result of this javascript and put it inside some element in XSP. But when I write the following code in XSP using javascript: p xsp:logic var js = window.open(given-file.html); var result = js.document.body.innerHTML; /xsp:logic xsp:exprresult/xsp:expr /p nothing happens (even doesn't give any error). If I am using this code inside an html file's script tag, it works fine. If I am trying some simple Javascript functions in XSP (e.g. Date()), it works. Maybe there is some problem with opening files in XSP? Can somebody please tell me what am I doing wrong and how can I get the result of javascript code executed in some given file? Thank you very much in advance. Anna - 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: Javascript problems in XSP
No. Look in your cocoon\docs\samples\xsp-js directory, there are some examples of xsp using Javascript. You just need to put map:parameter name=programming-language value=js/ into your xsp generator. - Original Message - From: Jacob L E Blain Christen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 21, 2002 6:45 PM Subject: Re: Javascript problems in XSP I may be mistaken but I thought the only valid code inside of xsp:logic tags was java: not javascript, not perl, just java. - 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: JavaScript problems in XSP
Why are you using document.write? document of course is a reference to the client side document object which doesn't exist server side at all. The problem with your example is that you don't need javascript (or xsp for that matter) to do any of that. Obviously you want to move beyond that though. It's also unclear whether you want that fragment to be included in the sax stream, or whether you want that output escaped and displayed as is on screen (i think the first). I'm not sure you can (using javascript in xsp) easily take an xml fragment in string form and generate sax events from it. It doesn't matter though because you probably really don't need to. What you should probably do is start with (note the ... implies that you probably have other page structure but you don't need to for this example) xsp:page language=javascript xmlns:xsp=http://apache.org/xsp; ... center font size=+3 This HTML-document has been created with the help of JavaScript! /font /center ... /xsp:page And then use xsp:logic xsp:expr xsp:attribute xsp:element etc to make whatever parts dynamic. For example, a next step might be : xsp:page language=javascript xmlns:xsp=http://apache.org/xsp; ... xsp:logic message = This HTML-document has been created with the help of JavaScript!; /xsp:logic center font size=+3 xsp:exprmessage/xsp:expr /font /center ... /xsp:page and then, xsp:page language=javascript xmlns:xsp=http://apache.org/xsp; ... xsp:logic message = This HTML-document has been created with the help of JavaScript!; displayMessage = true; /xsp:logic ... xsp:logic if (displayMessage) { center font size=+3 xsp:exprmessage/xsp:expr /font /center } /xsp:logic ... /xsp:page The best place I know of to read up on the xsp sytax is http://outerthought.net/wiki/Wiki.jsp?page=XSPSyntax as the official docs don't catalog the available tags IIRC. If you don't mind me saying so, I'd also suggest that you read up some more on the basic ideas behind the cocoon sax pipeline concept and what generators do as it seems you may have some of the concepts muddled. XSP is only a tool for automatically creating a generator - a compiled java class no matter what language you script your xsp in. Best of luck, Geoff Howard --- Anna Afonchenko [EMAIL PROTECTED] wrote: Thank you Ryan. Now what I get when I run the pipeline, what I see is the result of running the javascript. But what I really need is the source of this javascript, e.g. if the javascript code was: document.write(centerfont size=+3); document.write(This HTML-document has been created ); document.write(with the help of JavaScript!); document.write(/font/center); I want to get as a result the xhtml tree fragment that is created, e.g. I want to get back: center font size=+3 This HTML-document has been created with the help of JavaScript! /font /center e.g. I want to see the actual HTML code that was used in javascript to create the given page, and not the result of executing it. Is it doable in Cocoon/XSP? Thank you very much for your help. Anna - Original Message - From: Ryan Agler [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 21, 2002 4:26 PM Subject: RE: JavaScript problems in XSP Hi Anna, Client-side (in your web browser) JavaScript is a completely different beast than server-side (on your web server) JavaScript. In server-side JavaScript, there are no windows, DHTML, or much any other properties or methods you would use to manipulate a browser for dynamic content. To use Cocoon to achieve your task, the first step would to define given-file.html in your sitemap, and make sure its serialized in well-formed XHTML. Then you could use the Cinclude transformer to import given-file.html, kind of like this (myfile.xsp): ?xml version=1.0? xsp:page language=java xmlns:xsp=http://apache.org/xsp page xmlns:cinclude=http://apache.org/cocoon/include/1.0; p cinclude:include src=cocoon:/given-file.html / /p /page /xsp:page and in your sitemap.xmap: map:match pattern=given-file.html map:generate type=serverpages src=docs/given-file.xsp / map:transform src=stylesheets/given-file.xsl / map:serialize type=xhtml/ /map:match map:match pattern=myfile.xsl map:generate type=serverpages src=docs/myfile.xsp / map:transform type=cinclude/ map:transform src=stylesheets/myfile.xsl / map:serialize / /map:match HTH +Ryan -Original Message- From: Anna Afonchenko [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 21, 2002 7:43 AM To: [EMAIL PROTECTED] Subject: Javascript problems in XSP Hi All. This is my first post, so don't be angry with me if I do something wrong. I am using XSP on Cocoon 2.0.3, and I want to do the following: given a name of the html file that contains javascript, I want to get the result of this javascript
Javascript problems in XSP
Hi All. This is my first post, so don't be angry with me if I do something wrong. I am using XSP on Cocoon 2.0.3, and I want to do the following: given a name of the htmlfile that contains javascript, I want to get the result of this javascript and put it inside some element in XSP. But when I write the following code in XSP using javascript: p xsp:logic var js = window.open("given-file.html"); var result = js.document.body.innerHTML; /xsp:logic xsp:exprresult/xsp:expr /p nothing happens (even doesn't give any error). If I am using this code inside an html file's script tag, it works fine. If I am trying some simple Javascript functions in XSP (e.g. Date()), it works. Maybe there is some problem with opening files in XSP? Can somebody please tell me what am I doing wrong and how can I get the result of javascript code executed in some given file? Thank you very much in advance. Anna
RE: JavaScript problems in XSP
Hi Anna, Client-side (in your web browser) JavaScript is a completely different beast than server-side (on your web server) JavaScript. In server-side JavaScript, there are no windows, DHTML, or much any other properties or methods you would use to manipulate a browser for dynamic content. To use Cocoon to achieve your task, the first step would to define given-file.html in your sitemap, and make sure its serialized in well-formed XHTML. Then you could use the Cinclude transformer to import given-file.html, kind of like this (myfile.xsp): ?xml version=1.0? xsp:page language=java xmlns:xsp=http://apache.org/xsp page xmlns:cinclude=http://apache.org/cocoon/include/1.0; p cinclude:include src=cocoon:/given-file.html / /p /page /xsp:page and in your sitemap.xmap: map:match pattern=given-file.html map:generate type=serverpages src=docs/given-file.xsp / map:transform src=stylesheets/given-file.xsl / map:serialize type=xhtml/ /map:match map:match pattern=myfile.xsl map:generate type=serverpages src=docs/myfile.xsp / map:transform type=cinclude/ map:transform src=stylesheets/myfile.xsl / map:serialize / /map:match HTH +Ryan -Original Message- From: Anna Afonchenko [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 21, 2002 7:43 AM To: [EMAIL PROTECTED] Subject: Javascript problems in XSP Hi All. This is my first post, so don't be angry with me if I do something wrong. I am using XSP on Cocoon 2.0.3, and I want to do the following: given a name of the html file that contains javascript, I want to get the result of this javascript and put it inside some element in XSP. But when I write the following code in XSP using javascript: p xsp:logic var js = window.open(given-file.html); var result = js.document.body.innerHTML; /xsp:logic xsp:exprresult/xsp:expr /p nothing happens (even doesn't give any error). If I am using this code inside an html file's script tag, it works fine. If I am trying some simple Javascript functions in XSP (e.g. Date()), it works. Maybe there is some problem with opening files in XSP? Can somebody please tell me what am I doing wrong and how can I get the result of javascript code executed in some given file? Thank you very much in advance. Anna - 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: Javascript problems in XSP
I may be mistaken but I thought the only valid code inside of xsp:logic tags was java: not javascript, not perl, just java. - 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]
Character encoding problems with XSP/ESQL
Hi, I'm having problems convincing Cocoon to display unusual characters (such as smart quotes, apostrophes) properly, despite having tried everything suggested on the list in recent weeks to fix this. My setup: - Cocoon 2.0.3-dev - Tomcat 4.0.1 - Postgres 7.2 - Linux The content is being pulled from the DB via an XSP. The same content displays fine when pulled from the DB with perl(!). I've tried: Setting encoding in sitemap serializers: encodingiso-8859-1/encoding Setting encoding in XSP files: ?xml version=1.0 encoding=iso-8859-1? Setting encoding in ESQL: esql:row-results esql:encodingiso-8859-1/esql:encoding Setting encoding in JDBC connector: jdbc charsetiso-8859-1/charset and dburljdbc:postgresql://localhost:5432/foo?charset=iso-8859-1/dburl Starting Tomcat with $CATALINA_OPTS set to '-Dfile.encoding=ISO8859_1' ... none of this has worked. I continually get a ? in the output HTML. HELP! Andrew. -- Andrew SavoryEmail: [EMAIL PROTECTED] Managing Director Tel: +44 (0)870 741 6658 Luminas Internet Applications Fax: +44 (0)700 598 1135 This is not an official statement or order.Web:www.luminas.co.uk - 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: Character encoding problems with XSP/ESQL
Hi Andrew, Did you set encodingiso-8859-1/encoding for serverpages generator also? Do you also use some transformers? Roman Andrew Savory wrote: Hi, I'm having problems convincing Cocoon to display unusual characters (such as smart quotes, apostrophes) properly, despite having tried everything suggested on the list in recent weeks to fix this. My setup: - Cocoon 2.0.3-dev - Tomcat 4.0.1 - Postgres 7.2 - Linux The content is being pulled from the DB via an XSP. The same content displays fine when pulled from the DB with perl(!). I've tried: Setting encoding in sitemap serializers: encodingiso-8859-1/encoding Setting encoding in XSP files: ?xml version=1.0 encoding=iso-8859-1? Setting encoding in ESQL: esql:row-results esql:encodingiso-8859-1/esql:encoding Setting encoding in JDBC connector: jdbc charsetiso-8859-1/charset and dburljdbc:postgresql://localhost:5432/foo?charset=iso-8859-1/dburl Starting Tomcat with $CATALINA_OPTS set to '-Dfile.encoding=ISO8859_1' ... none of this has worked. I continually get a ? in the output HTML. HELP! Andrew. -- Andrew SavoryEmail: [EMAIL PROTECTED] Managing Director Tel: +44 (0)870 741 6658 Luminas Internet Applications Fax: +44 (0)700 598 1135 This is not an official statement or order.Web:www.luminas.co.uk - 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: Character encoding problems with XSP/ESQL
On Thu, 13 Jun 2002, KOZLOV Roman wrote: Hi Andrew, Did you set encodingiso-8859-1/encoding for serverpages generator also? Do you also use some transformers? Yup, set encoding on anything and everything that might affect it. Still not working :-/ Andrew. -- Andrew SavoryEmail: [EMAIL PROTECTED] Managing Director Tel: +44 (0)870 741 6658 Luminas Internet Applications Fax: +44 (0)700 598 1135 This is not an official statement or order.Web:www.luminas.co.uk - 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: Character encoding problems with XSP/ESQL
Andrew, I helped Michael Mangeng to solve a similar problem a while ago. Well, similar..., it was a pure xsp problem there, no esql. I have no expercience with esql, but I'll add some things you can try, but I don't know it is in fact the same problem :-) This is what Vadim reported, after Michael posted his solution: As of Cocoon 2.0.3 (which has some XSP fixes) it should work like this: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- How to use german umlauts on english *nix systems: sitemap.xmap: Use encodingISO-8859-1/encoding in the according (e.g. html) map:serializer tag. XML/XSP: Use: ?xml version=1.0 encoding=ISO-8859-1? -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- I don't know which version of Cocoon you're using, but according to Vadim this should work, so try this first. If this doesn't help you (I don't know if Michael eventually tested it this way), take a look at the nice overview of our solution. Michael posted it some days ago, here are the points: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- How to use german umlauts on english *nix systems: Set *nix locale to de_AT (or de_DE): localedef -c -i de_AT -f ISO-8859-1 de_AT Set LANG (system environment var) to de_AT (or de_DE) export LANG='de_AT' Before starting Tomcat set: $CATALINA_OPTS to '-Dfile.encoding=ISO8859_1' sitemap.xmap: Use encodingISO-8859-1/encoding in the according (e.g. html) map:serializer tag. XML/XSP: Use: ?xml version=1.0 encoding=ISO-8859-1? -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- As you can see, it has someting to do with the locale settings of *nix. It took me some time to figure it out a while ago, but it does make sense, if you consider that xsp's get converted to Java classes on the filesystem. And finally, if this doesn't work either, I think it has to do with the esql part of your problem. For that you'll have to find someone more experienced with esql :-) Hope this helps you any further! Greetz, Jan visit us @ http://www.xume.be -Original Message- From: Andrew Savory [mailto:[EMAIL PROTECTED]]On Behalf Of Andrew Savory Sent: donderdag 13 juni 2002 20:14 To: [EMAIL PROTECTED] Subject: Re: Character encoding problems with XSP/ESQL On Thu, 13 Jun 2002, KOZLOV Roman wrote: Hi Andrew, Did you set encodingiso-8859-1/encoding for serverpages generator also? Do you also use some transformers? Yup, set encoding on anything and everything that might affect it. Still not working :-/ Andrew. -- Andrew SavoryEmail: [EMAIL PROTECTED] Managing Director Tel: +44 (0)870 741 6658 Luminas Internet Applications Fax: +44 (0)700 598 1135 This is not an official statement or order.Web:www.luminas.co.uk - 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: Character encoding problems with XSP/ESQL
Hi Jan, On Thu, 13 Jun 2002, Jan Uyttenhove wrote: I helped Michael Mangeng to solve a similar problem a while ago. Well, similar..., it was a pure xsp problem there, no esql. I have no expercience with esql, but I'll add some things you can try, but I don't know it is in fact the same problem :-) Thanks for the list of fixes. Unfortunately, having followed your previous thread, I'd already worked through them all with no success :-( One other detail: when I don't set encoding, I get weird � instead of the right characters, but when I do set encoding, I get a single ? in place of the missing characters. Andrew. -- Andrew SavoryEmail: [EMAIL PROTECTED] Managing Director Tel: +44 (0)870 741 6658 Luminas Internet Applications Fax: +44 (0)700 598 1135 This is not an official statement or order.Web:www.luminas.co.uk - 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: Character encoding problems with XSP/ESQL
From: Andrew Savory [mailto:[EMAIL PROTECTED]] On Behalf Of Andrew Savory Hi Jan, On Thu, 13 Jun 2002, Jan Uyttenhove wrote: I helped Michael Mangeng to solve a similar problem a while ago. Well, similar..., it was a pure xsp problem there, no esql. I have no expercience with esql, but I'll add some things you can try, but I don't know it is in fact the same problem :-) Thanks for the list of fixes. Unfortunately, having followed your previous thread, I'd already worked through them all with no success :-( One other detail: when I don't set encoding, I get weird � instead of the right characters, but when I do set encoding, I get a single ? in place of the missing characters. Andrew, I would follow Jan's suggestion to isolate issue. First, make sure that static XML with your target encoding and your set of funny characters works ok. Then move on to the XSP. After that, add SQL. Chances are that your database returns broken strings. See also recent Argyn's email about it: he had *one* 3-byte Chinese character in the database, but it was extracted as *three* characters, i.e. string.size() returned 3 instead of 1, clearly indicating that string is broken and have to be re-encoded. Vadim Andrew. -- Andrew SavoryEmail: [EMAIL PROTECTED] Managing Director Tel: +44 (0)870 741 6658 Luminas Internet Applications Fax: +44 (0)700 598 1135 This is not an official statement or order.Web: www.luminas.co.uk - 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: Character encoding problems with XSP/ESQL
-Original Message- From: Vadim Gritsenko [mailto:[EMAIL PROTECTED]] Sent: donderdag 13 juni 2002 23:16 To: [EMAIL PROTECTED] Subject: RE: Character encoding problems with XSP/ESQL Andrew, I would follow Jan's suggestion to isolate issue. First, make sure that static XML with your target encoding and your set of funny characters works ok. Then move on to the XSP. After that, add SQL. Chances are that your database returns broken strings. See also recent Argyn's email about it: he had *one* 3-byte Chinese character in the database, but it was extracted as *three* characters, i.e. string.size() returned 3 instead of 1, clearly indicating that string is broken and have to be re-encoded. I agree with Vadim. But if XSP works just fine, and adding SQL seems to be the problem, it might be interesting to check the PostgreSQL mailing list also. I remember there are a lot of problems listed regarding character encoding, maybe it's a postgreSQL problem, to be more specific, a JDBC-PostgreSQL problem, since there's no problem using perl... Jan visit us @ http://www.xume.be - 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: Problems with XSP
From: Torsten Curdt [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, April 26, 2002 7:32 PM Subject: Re: Problems with XSP One could, of course, first run the XSP through a transformer that adds line number comments that are kept 'til the java file is generated, find the enclosing line number comments (well, one would suffice) output the XSP with the line highlighted that translates to the faulty java code Would be kind of overhead outside development but then, a deployed application wouldn't compile XSPs too often. hm.. you mean this way? ... xsp:logic int a = 5; /xsp:logic my:logicsheet-tag/ xsp:logic b = a; c = x; /xsp:logic ... transform it once to add the line numbers. (it would be cool if the XSP logicsheet could already provide this. but I fear that's not possible with XSLT) ... xsp:logic /* line:4 */ int a = 5; /xsp:logic my:logicsheet-tag/ xsp:logic /* line:8 */ b = a; /* line:9 */ c = x; /xsp:logic Then apply the logicsheets which might insert or remove lines from the original code: ... /* line:4 */ int a = 5; . /* line:8 */ b = a; /* line:9 */ c = x; Now the exception provides information about the final class line numbers. We still would need to obtaint the information as described. but we could then also parse the comment to get the original line number an present that one in a nice exception. the malicious line highlighted with +/- 5 lines. if there is no line number in comments we know it was introduced by a logicsheet and might not be very helpful to display this way. But as I said... quite some hours of work... question is: do people think this is helpful? people? comments please... -- Torsten Yes. This would be definitely helpful. When I used lex/yacc their line directives had me always pointing to the problem in my source. When the logic sheets are matured, it's also unlikely, that the error is in the logic sheet but not in your xsp. I had a short look into this and there are two bugreports on this at Sun which lead to a JSR. So this is definitely a problem, and having comments in the generated code, which point me to the line and file the code was generated from, would already help a lot. http://developer.java.sun.com/developer/bugParade/bugs/4026902.html http://developer.java.sun.com/developer/bugParade/bugs/4090367.html http://jcp.org/jsr/detail/045.jsp Jens -- jens.lorenz at interface-projects dot de interface:projects GmbH \\|// Tolkewitzer Strasse 49 (o o) 01277 Dresden oOOo~(_)~oOOo Germany - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with XSP
Torsten Curdt wrote: transform it once to add the line numbers. (it would be cool if the XSP logicsheet could already provide this. but I fear that's not possible with XSLT) ... xsp:logic /* line:4 */ int a = 5; Saxon has an extension function to retrieve the line number of the context node (saxon:lineNumber()). Maybe Xalan has an equivalent. J.Pietschmann - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems with XSP
On Fri, 26 Apr 2002, Vadim Gritsenko wrote: From: Graaf, Edgar de (fin) [mailto:[EMAIL PROTECTED]] Great... when I code XSP and when I make some error in the logic I get (of course) an error. An error contains a line number. Now I have to go to the work directory and look at the generated java file to find the error. Isn't it possible to display the line number of the error in the XSP? Suggest how it is possible. I have thought about this a while ago, too. We should be able to extract that from the exception stacktrace. It should also be even possible to display that line's sourcecode (preferable with some surrounding lines). But I wasn't sure if this is really worth the work... ...is there a need for it? -- Torsten - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems with XSP
I have thought about this a while ago, too. We should be able to extract that from the exception stacktrace. Line number in Java source is already shown, correctly. The question is how to map this to XSP source line numbers. well, addtionally we need the full classpath of the failed class itself from the stacktrace. then we need to lookup the java source code filename from the ProgrammGenerator. unfortunately that's not yet possible AFAICS. but as a workaround we might translate back the class into a path and use the workdir of the ProgrammGenerator as root, add the path and we should have the generated file path from the repository... What do you think? -- Torsten - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with XSP
On 26.Apr.2002 -- 03:59 PM, Torsten Curdt wrote: I have thought about this a while ago, too. We should be able to extract that from the exception stacktrace. Line number in Java source is already shown, correctly. The question is how to map this to XSP source line numbers. well, addtionally we need the full classpath of the failed class itself from the stacktrace. then we need to lookup the java source code filename from the ProgrammGenerator. unfortunately that's not yet possible AFAICS. but as a workaround we might translate back the class into a path and use the workdir of the ProgrammGenerator as root, add the path and we should have the generated file path from the repository... OK, that would make it easier to see the source (if I understand correctly, that is). But I believe the original problem is infeasible since we don't know what transformations happened on the way to the final XSP (all taglibs but XSP done). One could, of course, first run the XSP through a transformer that adds line number comments that are kept 'til the java file is generated, find the enclosing line number comments (well, one would suffice) output the XSP with the line highlighted that translates to the faulty java code Would be kind of overhead outside development but then, a deployed application wouldn't compile XSPs too often. Chris. -- C h r i s t i a n H a u l [EMAIL PROTECTED] fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with XSP
On 26.Apr.2002 -- 05:24 PM, Christian Haul wrote: On 26.Apr.2002 -- 03:59 PM, Torsten Curdt wrote: I have thought about this a while ago, too. We should be able to extract that from the exception stacktrace. Line number in Java source is already shown, correctly. The question is how to map this to XSP source line numbers. well, addtionally we need the full classpath of the failed class itself from the stacktrace. then we need to lookup the java source code filename from the ProgrammGenerator. unfortunately that's not yet possible AFAICS. but as a workaround we might translate back the class into a path and use the workdir of the ProgrammGenerator as root, add the path and we should have the generated file path from the repository... OK, that would make it easier to see the source (if I understand correctly, that is). But I believe the original problem is infeasible since we don't know what transformations happened on the way to the final XSP (all taglibs but XSP done). One could, of course, first run the XSP through a transformer that adds line number comments that are kept 'til the java file is generated, Mmmh, probably won't work as it presumes that logicsheets behave well which might not be true. Chris. -- C h r i s t i a n H a u l [EMAIL PROTECTED] fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems with XSP
Well now I have to go to the work directory and search the XSP. It would be easy if I just can jump to the right line number... Regards -Oorspronkelijk bericht- Van: Torsten Curdt [mailto:[EMAIL PROTECTED]] Verzonden: vrijdag 26 april 2002 14:26 Aan: [EMAIL PROTECTED] Onderwerp: RE: Problems with XSP On Fri, 26 Apr 2002, Vadim Gritsenko wrote: From: Graaf, Edgar de (fin) [mailto:[EMAIL PROTECTED]] Great... when I code XSP and when I make some error in the logic I get (of course) an error. An error contains a line number. Now I have to go to the work directory and look at the generated java file to find the error. Isn't it possible to display the line number of the error in the XSP? Suggest how it is possible. I have thought about this a while ago, too. We should be able to extract that from the exception stacktrace. It should also be even possible to display that line's sourcecode (preferable with some surrounding lines). But I wasn't sure if this is really worth the work... ...is there a need for it? -- Torsten - 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: [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/faqs.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with XSP
I have thought about this a while ago, too. We should be able to extract that from the exception stacktrace. Line number in Java source is already shown, correctly. The question is how to map this to XSP source line numbers. well, addtionally we need the full classpath of the failed class itself from the stacktrace. then we need to lookup the java source code filename from the ProgrammGenerator. unfortunately that's not yet possible AFAICS. but as a workaround we might translate back the class into a path and use the workdir of the ProgrammGenerator as root, add the path and we should have the generated file path from the repository... OK, that would make it easier to see the source (if I understand correctly, that is). But I believe the original problem is infeasible since we don't know what transformations happened on the way to the final XSP (all taglibs but XSP done). true... that's why I am not sure if it is really worth the work. fact is: it will only really be useful if the error does not come from a logicsheet. otherwise you would present code to the user/developer he has probably never seen before. it might be easier to track things though... I am really torn apart :-/ Some comments from XSP *users* would be fine... One could, of course, first run the XSP through a transformer that adds line number comments that are kept 'til the java file is generated, find the enclosing line number comments (well, one would suffice) output the XSP with the line highlighted that translates to the faulty java code Would be kind of overhead outside development but then, a deployed application wouldn't compile XSPs too often. hm.. you mean this way? ... xsp:logic int a = 5; /xsp:logic my:logicsheet-tag/ xsp:logic b = a; c = x; /xsp:logic ... transform it once to add the line numbers. (it would be cool if the XSP logicsheet could already provide this. but I fear that's not possible with XSLT) ... xsp:logic /* line:4 */ int a = 5; /xsp:logic my:logicsheet-tag/ xsp:logic /* line:8 */ b = a; /* line:9 */ c = x; /xsp:logic Then apply the logicsheets which might insert or remove lines from the original code: ... /* line:4 */ int a = 5; . /* line:8 */ b = a; /* line:9 */ c = x; Now the exception provides information about the final class line numbers. We still would need to obtaint the information as described. but we could then also parse the comment to get the original line number an present that one in a nice exception. the malicious line highlighted with +/- 5 lines. if there is no line number in comments we know it was introduced by a logicsheet and might not be very helpful to display this way. But as I said... quite some hours of work... question is: do people think this is helpful? people? comments please... -- Torsten - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with XSP
I've checked the Tomcat work directory, and there's just compteur_xsp.java. So compteur.xsp must not be correct. The code is the following: ?xml version="1.0"?xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core"xsp:logicstatic private int counter = 0; private synchronized int count(){return counter++;}/xsp:logic pagep J'ai été visitée xsp:exprcount()/xsp:expr fois. /p/page/xsp:page Someone could tell me where's the error, please? Best, Cyril. - Original Message - From: Graaf, Edgar de (fin) To: '[EMAIL PROTECTED]' Sent: Wednesday, April 24, 2002 11:22 AM Subject: RE: Problems with XSP Your XSP was not compiled because it contains some error. Then you don't have a class and get a ClassNotFoundException. Search in the Tomcat work directory for compteur. Do you only find compteur_xsp.java? Or also compteur_xsp.class? Regards Edgar -Oorspronkelijk bericht-Van: cyril vidal [mailto:[EMAIL PROTECTED]]Verzonden: dinsdag 23 april 2002 21:55Aan: [EMAIL PROTECTED]Onderwerp: Problems with XSP HY! Iwould liketo execute a very simple XSP sample. Here is my sitemap: map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0" map:components map:generators default="file" map:generator name="file" src="org.apache.cocoon.generation.FileGenerator"/ map:generator name="serverpages" src="org.apache.cocoon.generation.ServerPagesGenerator"//map:generators map:transformers default="xslt" map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer"//map:transformers map:readers default="resource" map:reader name="resource" src="org.apache.cocoon.reading.ResourceReader"//map:readers map:serializers default="html" map:serializer name="xml" mime-type="text/xml" src="org.apache.cocoon.serialization.XMLSerializer"/ map:serializer name="html" mime-type="text/html" src="org.apache.cocoon.serialization.HTMLSerializer"/ map:serializer name="svg2png" src="org.apache.cocoon.serialization.SVGSerializer" mime-type="image/png"/ map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer" mime-type="application/pdf"//map:serializers map:matchers default="wildcard" map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"//map:matchers /map:components map:pipelines map:pipeline map:match pattern="index.html" map:read src="static/index.html" mime-type="text/html"/ /map:match /map:pipeline map:pipeline map:match pattern="CinemaFO.pdf" map:generate src="static/CinemaFO.xml"/ map:transform src="transforms/CinemaFO.xsl"/ map:serialize type="fo2pdf"/ /map:match /map:pipeline map:pipeline map:match pattern="compteur.xsp" map:generate type="serverpages" src="transforms/compteur.xsp"/ map:transform src="transforms/page-html.xsl"/ map:serialize/ /map:match /map:pipeline /map:pipelines /map:sitemap Unfortunately, when I execute the file compteur.xsp, I get the following error message: type fatal message Language Exception description org.apache.cocoon.ProcessingException: Language Exception: org.apache.cocoon.components.language.LanguageException: Could not load class for program 'org\apache\cocoon\www\transforms\compteur_xsp' due to a java.lang.ClassNotFoundException: org.apache.cocoon.www.transforms.compteur_xsp sender org.apache.cocoon.servlet.CocoonServlet source Cocoon servlet request-uri/essai/compteur.xsp path-infocompteur.xspSomeone could help me, please?Thanks,Cyril.
RE: Problems with XSP
1. Check XSP namespace. It is not correct. 2. Is this valid UTF-8? Or ISO-8859-1? Specify encoding in ?xml? instruction. Vadim -Original Message- From: cyril vidal [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 2:41 PM To: [EMAIL PROTECTED] Subject: Re: Problems with XSP I've checked the Tomcat work directory, and there's just compteur_xsp.java. So compteur.xsp must not be correct. The code is the following: ?xml version=1.0? xsp:page language=java xmlns:xsp=http://www.apache.org/1999/XSP/Core; xsp:logic static private int counter = 0; private synchronized int count(){ return counter++; } /xsp:logic page p J'ai été visitée xsp:exprcount()/xsp:expr fois. /p /page /xsp:page Someone could tell me where's the error, please? Best, Cyril. - Original Message - From: Graaf, Edgar de (fin) To: '[EMAIL PROTECTED]' Sent: Wednesday, April 24, 2002 11:22 AM Subject: RE: Problems with XSP Your XSP was not compiled because it contains some error. Then you don't have a class and get a ClassNotFoundException. Search in the Tomcat work directory for compteur. Do you only find compteur_xsp.java? Or also compteur_xsp.class? Regards Edgar -Oorspronkelijk bericht- Van: cyril vidal [mailto:[EMAIL PROTECTED]] Verzonden: dinsdag 23 april 2002 21:55 Aan: [EMAIL PROTECTED] Onderwerp: Problems with XSP HY! I would like to execute a very simple XSP sample. Here is my sitemap: map:sitemap xmlns:map=http://apache.org/cocoon/sitemap/1.0; map:components map:generators default=file map:generator name=file src=org.apache.cocoon.generation.FileGenerator/ map:generator name=serverpages src=org.apache.cocoon.generation.ServerPagesGenerator/ /map:generators map:transformers default=xslt map:transformer name=xslt src=org.apache.cocoon.transformation.TraxTransformer/ /map:transformers map:readers default=resource map:reader name=resource src=org.apache.cocoon.reading.ResourceReader/ /map:readers map:serializers default=html map:serializer name=xml mime-type=text/xml src=org.apache.cocoon.serialization.XMLSerializer/ map:serializer name=html mime-type=text/html src=org.apache.cocoon.serialization.HTMLSerializer/ map:serializer name=svg2png src=org.apache.cocoon.serialization.SVGSerializer mime-type=image/png/ map:serializer name=fo2pdf src=org.apache.cocoon.serialization.FOPSerializer mime-type=application/pdf/ /map:serializers map:matchers default=wildcard map:matcher name=wildcard src=org.apache.cocoon.matching.WildcardURIMatcher/ /map:matchers /map:components map:pipelines map:pipeline map:match pattern=index.html map:read src=static/index.html mime-type=text/html/ /map:match /map:pipeline map:pipeline map:match pattern=CinemaFO.pdf map:generate src=static/CinemaFO.xml/ map:transform src=transforms/CinemaFO.xsl/ map:serialize type=fo2pdf/ /map:match /map:pipeline map:pipeline map:match pattern=compteur.xsp map:generate type=serverpages src=transforms/compteur.xsp/ map:transform src=transforms/page-html.xsl/ map:serialize/ /map:match /map:pipeline /map:pipelines /map:sitemap Unfortunately, when I execute the file compteur.xsp, I get the following error message: type fatal message Language Exception description org.apache.cocoon.ProcessingException: Language Exception: org.apache.cocoon.components.language.LanguageException: Could not load class for program 'org\apache\cocoon\www\transforms\compteur_xsp' due to a java.lang.ClassNotFoundException: org.apache.cocoon.www.transforms.compteur_xsp sender org.apache.cocoon.servlet.CocoonServlet source Cocoon servlet request-uri /essai/compteur.xsp path-info compteur.xsp Someone could help me, please? Thanks, Cyril. - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with XSP
Thanks Vadim! It's now OK... - Original Message - From: Vadim Gritsenko [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 25, 2002 11:14 PM Subject: RE: Problems with XSP From: cyril vidal [mailto:[EMAIL PROTECTED]] I've put away the language attribute on the namespace. So I have: ?xml version=1.0 encoding=iso-8859-1? xsp:page xmlns:xsp=http://www.apache.org/1999/XSP/Core; You still have wrong namespace. From hello.xsp: xsp:page language=java xmlns:xsp=http://apache.org/xsp; page ... /page /xsp:page Vadim xsp:logic static private int counter = 0; private synchronized int count(){ return counter++; } /xsp:logic page p J'ai été visitée xsp:exprcount()/xsp:expr fois. /p /page /xsp:page but it still doesn't work... - Original Message - From: Vadim Gritsenko [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 25, 2002 9:52 PM Subject: RE: Problems with XSP 1. Check XSP namespace. It is not correct. 2. Is this valid UTF-8? Or ISO-8859-1? Specify encoding in ?xml? instruction. Vadim -Original Message- From: cyril vidal [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 2:41 PM To: [EMAIL PROTECTED] Subject: Re: Problems with XSP I've checked the Tomcat work directory, and there's just compteur_xsp.java. So compteur.xsp must not be correct. The code is the following: ?xml version=1.0? xsp:page language=java xmlns:xsp=http://www.apache.org/1999/XSP/Core; xsp:logic static private int counter = 0; private synchronized int count(){ return counter++; } /xsp:logic page p J'ai été visitée xsp:exprcount()/xsp:expr fois. /p /page /xsp:page Someone could tell me where's the error, please? Best, Cyril. - Original Message - From: Graaf, Edgar de (fin) To: '[EMAIL PROTECTED]' Sent: Wednesday, April 24, 2002 11:22 AM Subject: RE: Problems with XSP Your XSP was not compiled because it contains some error. Then you don't have a class and get a ClassNotFoundException. Search in the Tomcat work directory for compteur. Do you only find compteur_xsp.java? Or also compteur_xsp.class? Regards Edgar -Oorspronkelijk bericht- Van: cyril vidal [mailto:[EMAIL PROTECTED]] Verzonden: dinsdag 23 april 2002 21:55 Aan: [EMAIL PROTECTED] Onderwerp: Problems with XSP HY! I would like to execute a very simple XSP sample. Here is my sitemap: map:sitemap xmlns:map=http://apache.org/cocoon/sitemap/1.0; map:components map:generators default=file map:generator name=file src=org.apache.cocoon.generation.FileGenerator/ map:generator name=serverpages src=org.apache.cocoon.generation.ServerPagesGenerator/ /map:generators map:transformers default=xslt map:transformer name=xslt src=org.apache.cocoon.transformation.TraxTransformer/ /map:transformers map:readers default=resource map:reader name=resource src=org.apache.cocoon.reading.ResourceReader/ /map:readers map:serializers default=html map:serializer name=xml mime-type=text/xml src=org.apache.cocoon.serialization.XMLSerializer/ map:serializer name=html mime-type=text/html src=org.apache.cocoon.serialization.HTMLSerializer/ map:serializer name=svg2png src=org.apache.cocoon.serialization.SVGSerializer mime-type=image/png/ map:serializer name=fo2pdf src=org.apache.cocoon.serialization.FOPSerializer mime-type=application/pdf/ /map:serializers map:matchers default=wildcard map:matcher name=wildcard src=org.apache.cocoon.matching.WildcardURIMatcher/ /map:matchers /map:components map:pipelines map:pipeline map:match pattern=index.html map:read src=static/index.html mime-type=text/html/ /map:match /map:pipeline map:pipeline map:match pattern=CinemaFO.pdf map:generate src=static/CinemaFO.xml/ map:transform src=transforms/CinemaFO.xsl/ map:serialize type=fo2pdf/ /map:match /map:pipeline map:pipeline map:match pattern=compteur.xsp map:generate type=serverpages src=transforms/compteur.xsp/ map:transform src=transforms/page-html.xsl/ map:serialize/ /map:match /map:pipeline /map:pipelines /map:sitemap Unfortunately, when I execute the file compteur.xsp, I get the following error message: type fatal message Language Exception description org.apache.cocoon.ProcessingException: Language Exception: org.apache.cocoon.components.language.LanguageException: Could not load class for program 'org\apache\cocoon\www\transforms\compteur_xsp' due to a java.lang.ClassNotFoundException: org.apache.cocoon.www.transforms.compteur_xsp sender org.apache.cocoon.servlet.CocoonServlet source Cocoon servlet request-uri /essai/compteur.xsp path-info compteur.xsp Someone could help me, please? Thanks, Cyril. - 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: [EMAIL PROTECTED] For additional commands, e
Re: Problems with XSP
On 23.Apr.2002 -- 09:54 PM, cyril vidal wrote: map:match pattern=compteur.xsp map:generate type=serverpages src=transforms/compteur.xsp/ You're sure you've got the right path to your file? Chris. -- C h r i s t i a n H a u l [EMAIL PROTECTED] fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems with XSP
Your XSP was not compiled because it contains some error. Then you don't have a class and get a ClassNotFoundException. Search in the Tomcat work directory for compteur. Do you only find compteur_xsp.java? Or also compteur_xsp.class? Regards Edgar -Oorspronkelijk bericht-Van: cyril vidal [mailto:[EMAIL PROTECTED]]Verzonden: dinsdag 23 april 2002 21:55Aan: [EMAIL PROTECTED]Onderwerp: Problems with XSP HY! Iwould liketo execute a very simple XSP sample. Here is my sitemap: map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0" map:components map:generators default="file" map:generator name="file" src="org.apache.cocoon.generation.FileGenerator"/ map:generator name="serverpages" src="org.apache.cocoon.generation.ServerPagesGenerator"//map:generators map:transformers default="xslt" map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer"//map:transformers map:readers default="resource" map:reader name="resource" src="org.apache.cocoon.reading.ResourceReader"//map:readers map:serializers default="html" map:serializer name="xml" mime-type="text/xml" src="org.apache.cocoon.serialization.XMLSerializer"/ map:serializer name="html" mime-type="text/html" src="org.apache.cocoon.serialization.HTMLSerializer"/ map:serializer name="svg2png" src="org.apache.cocoon.serialization.SVGSerializer" mime-type="image/png"/ map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer" mime-type="application/pdf"//map:serializers map:matchers default="wildcard" map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"//map:matchers /map:components map:pipelines map:pipeline map:match pattern="index.html" map:read src="static/index.html" mime-type="text/html"/ /map:match /map:pipeline map:pipeline map:match pattern="CinemaFO.pdf" map:generate src="static/CinemaFO.xml"/ map:transform src="transforms/CinemaFO.xsl"/ map:serialize type="fo2pdf"/ /map:match /map:pipeline map:pipeline map:match pattern="compteur.xsp" map:generate type="serverpages" src="transforms/compteur.xsp"/ map:transform src="transforms/page-html.xsl"/ map:serialize/ /map:match /map:pipeline /map:pipelines /map:sitemap Unfortunately, when I execute the file compteur.xsp, I get the following error message: type fatal message Language Exception description org.apache.cocoon.ProcessingException: Language Exception: org.apache.cocoon.components.language.LanguageException: Could not load class for program 'org\apache\cocoon\www\transforms\compteur_xsp' due to a java.lang.ClassNotFoundException: org.apache.cocoon.www.transforms.compteur_xsp sender org.apache.cocoon.servlet.CocoonServlet source Cocoon servlet request-uri/essai/compteur.xsp path-infocompteur.xspSomeone could help me, please?Thanks,Cyril.
Problems with XSP
HY! Iwould liketo execute a very simple XSP sample. Here is my sitemap: map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0" map:components map:generators default="file" map:generator name="file" src="org.apache.cocoon.generation.FileGenerator"/ map:generator name="serverpages" src="org.apache.cocoon.generation.ServerPagesGenerator"//map:generators map:transformers default="xslt" map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer"//map:transformers map:readers default="resource" map:reader name="resource" src="org.apache.cocoon.reading.ResourceReader"//map:readers map:serializers default="html" map:serializer name="xml" mime-type="text/xml" src="org.apache.cocoon.serialization.XMLSerializer"/ map:serializer name="html" mime-type="text/html" src="org.apache.cocoon.serialization.HTMLSerializer"/ map:serializer name="svg2png" src="org.apache.cocoon.serialization.SVGSerializer" mime-type="image/png"/ map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer" mime-type="application/pdf"//map:serializers map:matchers default="wildcard" map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"//map:matchers /map:components map:pipelines map:pipeline map:match pattern="index.html" map:read src="static/index.html" mime-type="text/html"/ /map:match /map:pipeline map:pipeline map:match pattern="CinemaFO.pdf" map:generate src="static/CinemaFO.xml"/ map:transform src="transforms/CinemaFO.xsl"/ map:serialize type="fo2pdf"/ /map:match /map:pipeline map:pipeline map:match pattern="compteur.xsp" map:generate type="serverpages" src="transforms/compteur.xsp"/ map:transform src="transforms/page-html.xsl"/ map:serialize/ /map:match /map:pipeline /map:pipelines /map:sitemap Unfortunately, when I execute the file compteur.xsp, I get the following error message: type fatal message Language Exception description org.apache.cocoon.ProcessingException: Language Exception: org.apache.cocoon.components.language.LanguageException: Could not load class for program 'org\apache\cocoon\www\transforms\compteur_xsp' due to a java.lang.ClassNotFoundException: org.apache.cocoon.www.transforms.compteur_xsp sender org.apache.cocoon.servlet.CocoonServlet source Cocoon servlet request-uri/essai/compteur.xsp path-infocompteur.xspSomeone could help me, please?Thanks,Cyril.
Re: Problems with XSP when upgrading 1.8.2 - 2.0.2
Title: Re: Problems with XSP when upgrading 1.8.2 - 2.0.2 I got only half of your mail in black berry. There should be an api to convert sax to dom and read dom into sax api. I will let you know soon. -- Sent from my BlackBerry Wireless Handheld (www.BlackBerry.net)
Problems with XSP when upgrading 1.8.2 - 2.0.2
Title: Problems with XSP when upgrading 1.8.2 - 2.0.2 Sending again, as I haven't received a response, and I'm at my wits' end, I've been unable to find answers anywhere... -Original Message- From: William Bagby Sent: Friday, April 12, 2002 10:52 AM To: Cocoon Users Mailing List (E-mail) Subject: Problems with XSP when upgrading 1.8.2 - 2.0.2 Forwarding this again, I think I sent to first one as HTML, which I think the list doesn't recognize. I have looked in the mailing lists, to no avail, please forgive me if these questions have been answered already I have upgraded Cocoon 1.8.2 to Cocoon 2.0.2. Here's my setup: Cocoon 2.0.2 Weblogic 6.0sp2 Solaris 2.6 (Sparc) I have successfully installed C2, all the samples work, etc. but I am having a problem getting my logicsheets to work. I am having 2 separate problems: Problem 1: Transition from DOM to SAX In my logicsheets I have a number of places where I dynamically insert an XML document, then use the DOM API to access values of specific nodes. I have come to realize that since C2 uses SAX, I can no longer do this. Here's an example: String name = Joe; NodeList ca = document.getElementsByTagName( employee ); if ( ca != null ) { Element element = null; String myAttr = ; int length = ca.getLength(); for (int j = 0; j lt; length; j++) { element = (Element) ca.item(j); myAttr = element.getAttribute( name ); if ( !myAttr.equals( name ) ) continue; myValue = element.getAttribute( value ); break; } } So if I have the following XML fragment: employee name=John value=23/ employee name=Jack value=34/ employee name=Joe value=45/ employee name=Joanne value=56/ employee name=Jimmy value=67/ I want the value 45. How would I do this with SAX? Problem 2: request and response using C2 specific implementation, rather than javax.servlet.http.HttpRequest and javax.servlet.http.HttpResponse I use some EJB's which have methods that take the built-in XSP variables 'request' and 'response' as params. It does not work now. Is there a way to cast org.apache.cocoon.environment.Request as javax.servlet.http.HttpRequest (and likewise for Response), or is there a better way to do it? I would like to avoid having to modify the EJBs, which at this point would be a Hurculean task. Sorry if these don't seem to be Cocoon 2 questions, but I was thinking maybe some of you have similar problems. Thanks in advance... William Bagby.
RE: Problems with XSP when upgrading 1.8.2 - 2.0.2
Try sending plain text email. It might help - not everybody reads HTML. Vadim -Original Message- From: William Bagby [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 11:42 AM To: Cocoon Users Mailing List (E-mail) Subject: Problems with XSP when upgrading 1.8.2 - 2.0.2 Sending again, as I haven't received a response, and I'm at my wits' end, I've been unable to find answers anywhere... -Original Message- From: William Bagby Sent: Friday, April 12, 2002 10:52 AM To: Cocoon Users Mailing List (E-mail) Subject: Problems with XSP when upgrading 1.8.2 - 2.0.2 Forwarding this again, I think I sent to first one as HTML, which I think the list doesn't recognize. I have looked in the mailing lists, to no avail, please forgive me if these questions have been answered already I have upgraded Cocoon 1.8.2 to Cocoon 2.0.2. Here's my setup: Cocoon 2.0.2 Weblogic 6.0sp2 Solaris 2.6 (Sparc) I have successfully installed C2, all the samples work, etc. but I am having a problem getting my logicsheets to work. I am having 2 separate problems: Problem 1: Transition from DOM to SAX In my logicsheets I have a number of places where I dynamically insert an XML document, then use the DOM API to access values of specific nodes. I have come to realize that since C2 uses SAX, I can no longer do this. Here's an example: String name = Joe; NodeList ca = document.getElementsByTagName( employee ); if ( ca != null ) { Element element = null; String myAttr = ; int length = ca.getLength(); for (int j = 0; j lt; length; j++) { element = (Element) ca.item(j); myAttr = element.getAttribute( name ); if ( !myAttr.equals( name ) ) continue; myValue = element.getAttribute( value ); break; } } So if I have the following XML fragment: employee name=John value=23/ employee name=Jack value=34/ employee name=Joe value=45/ employee name=Joanne value=56/ employee name=Jimmy value=67/ I want the value 45. How would I do this with SAX? Problem 2: request and response using C2 specific implementation, rather than javax.servlet.http.HttpRequest and javax.servlet.http.HttpResponse I use some EJB's which have methods that take the built-in XSP variables 'request' and 'response' as params. It does not work now. Is there a way to cast org.apache.cocoon.environment.Request as javax.servlet.http.HttpRequest (and likewise for Response), or is there a better way to do it? I would like to avoid having to modify the EJBs, which at this point would be a Hurculean task. Sorry if these don't seem to be Cocoon 2 questions, but I was thinking maybe some of you have similar problems. Thanks in advance... William Bagby. - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problems with XSP when upgrading 1.8.2 - 2.0.2
Title: Problems with XSP when upgrading 1.8.2 - 2.0.2 I have looked in the mailing lists, to no avail, please forgive me if these questions have been answered already I have upgraded Cocoon 1.8.2 to Cocoon 2.0.2. Here's my setup: Cocoon 2.0.2 Weblogic 6.0sp2 Solaris 2.6 (Sparc) I have successfully installed C2, all the samples work, etc. but I am having a problem getting my logicsheets to work. I am having 2 separate problems: Problem 1: Transition from DOM to SAX In my logicsheets I have a number of places where I dynamically insert an XML document, then use the DOM API to access values of specific nodes. I have come to realize that since C2 uses SAX, I can no longer do this. Here's an example: String name = Joe; NodeList ca = document.getElementsByTagName( employee ); if ( ca != null ) { Element element = null; String myAttr = ; int length = ca.getLength(); for (int j = 0; j lt; length; j++) { element = (Element) ca.item(j); myAttr = element.getAttribute( name ); if ( !myAttr.equals( name ) ) continue; myValue = element.getAttribute( value ); break; } } So if I have the following XML fragment: employee name=John value=23/ employee name=Jack value=34/ employee name=Joe value=45/ employee name=Joanne value=56/ employee name=Jimmy value=67/ I want the value 45. How would I do this with SAX? Problem 2: request and response using C2 specific implementation, rather than javax.servlet.http.HttpRequest and javax.servlet.http.HttpResponse I use some EJB's which have methods that take the built-in XSP variables 'request' and 'response' as params. It does not work now. Is there a way to cast org.apache.cocoon.environment.Request as javax.servlet.http.HttpRequest (and likewise for Response), or is there a better way to do it? I would like to avoid having to modify the EJBs, which at this point would be a Hurculean task. Sorry if these don't seem to be Cocoon 2 questions, but I was thinking maybe some of you have similar problems. Thanks in advance... William Bagby.
Problems with XSP when upgrading 1.8.2 - 2.0.2
I have looked in the mailing lists, to no avail, please forgive me if these questions have been answered already I have upgraded Cocoon 1.8.2 to Cocoon 2.0.2. Here's my setup: Cocoon 2.0.2 Weblogic 6.0sp2 Solaris 2.6 (Sparc) I have successfully installed C2, all the samples work, etc. but I am having a problem getting my logicsheets to work. I am having 2 separate problems: Problem 1: Transition from DOM to SAX In my logicsheets I have a number of places where I dynamically insert an XML document, then use the DOM API to access values of specific nodes. I have come to realize that since C2 uses SAX, I can no longer do this. Here's an example: String name = "Joe"; NodeList ca = document.getElementsByTagName( "employee" ); if (ca != null ) { Element element = null; StringmyAttr = ""; int length = ca.getLength(); for (int j = 0; j lt;length; j++) { element = (Element) ca.item(j); myAttr = element.getAttribute( "name" ); if ( !myAttr.equals(name ) ) continue; myValue = element.getAttribute( "value" ); break; } } So if I have the following XML fragment: employee name="John" value="23"/ employee name="Jack" value="34"/ employee name="Joe" value="45"/ employee name="Joanne" value="56"/ employee name="Jimmy" value="67"/ I want the value "45". How would I do this with SAX? Problem 2: request and response using C2 specific implementation, rather than javax.servlet.http.HttpRequest and javax.servlet.http.HttpResponse I use some EJB's which have methods that take the built-in XSP variables 'request' and 'response' as params. It does not work now. Is there a way to cast org.apache.cocoon.environment.Request as javax.servlet.http.HttpRequest (and likewise for Response), or is there a better way to do it? I would like to avoid having to modify the EJBs, which at this point would be a Hurculean task. Sorry if these don't seem to be Cocoon 2 questions, but I was thinking maybe some of you have similar problems. Thanks in advance... William Bagby.
Problems with XSP files and Cocoon 2.0 Release
Hey guys, Is there a reason why changes to XSP files aren't picked up when I have the application set to reloadable and pass the ?cocoon-reload=1 parameter to a page request? Changes to JSP, XML, and sitemap files are caught, but if I change an XSP file I get this error: WARN(2001-12-02) 06:04.05:941 [cocoon ] (/dev/main3) Thread-34/ServerPagesGenerator: ServerPagesGenerat or.generate() java.lang.IllegalStateException: You cannot select a Component from a disposed ComponentSelector at org.apache.avalon.excalibur.component.ExcaliburComponentSelector.select(Unknown Source) at org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(ProgramGeneratorImpl.java :208) at org.apache.cocoon.generation.ServerPagesGenerator.setup(ServerPagesGenerator.java:170) at org.apache.cocoon.components.pipeline.AbstractEventPipeline.setupPipeline(AbstractEventPipeline.jav a:142) at org.apache.cocoon.components.pipeline.CachingEventPipeline.setup(CachingEventPipeline.java:239) at org.apache.cocoon.components.pipeline.CachingEventPipeline.generateKey(CachingEventPipeline.java:99 ) at org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingStreamPipeline.java:277) at org.apache.cocoon.www.sitemap_xmap.wildcardMatchN400239(sitemap_xmap.java:2705) at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:2041) at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1923) at org.apache.cocoon.sitemap.Handler.process(Handler.java:163) at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:114) at org.apache.cocoon.Cocoon.process(Cocoon.java:514) at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java) at org.apache.catalina.connector.warp.WarpRequestHandler.handle(WarpRequestHandler.java) at org.apache.catalina.connector.warp.WarpConnection.run(WarpConnection.java) at java.lang.Thread.run(Thread.java:484) So basically, any time I change an XSP file I have to restart Tomcat (even if I change the file back to it's original configuration Cocoon remains further broken with this current URL). I seem to have problems adding XSP files to the sitemap as well without restarting Tomcat. As I said above, I do not experience these problems when using JSPs or XML files. FYI: here is our configuration: Linux Mandrake 8.1 Tomcat 4.0.1 + Apache 1.3.19 via mod_webapp Cocoon 2.0 Release Binary Nothing else special about the configuration at all. Thanks! Bryan - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problems with XSP samples page
hello, I have a problem with XSP, the samples pages on cocoon do not work. I get no such axis exception. The rest of the cocoon works fine. Cocoon version is 1.8.2. Two suggestions from FAQ are implemented: problem with tools.jar and xml parser precedings. thanks for any help... Ivo, Croatia - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Upgrading to 1.8.2 : problems with XSP Processor [MORE PRECISIONS]
you are wrong. i use cocoon-1.8.2 with jdk-1.3. your problem seems to be with extraneous (dom1) classes in your servlet engine's classpath. Could you let me know your classpath? I could check mine and see what's wrong with my configuration. By the way, what JDK/platform are you using? Personnally : Linux + Sun JDK1.3. wrapper.classpath=/usr/local/apache/libexec/ApacheJServ.jar wrapper.classpath=/usr/local/java/lib/tools.jar wrapper.classpath=/usr/local/java/jre/lib/rt.jar wrapper.classpath=/usr/local/lib/java/jsdk.jar wrapper.classpath=/usr/local/lib/java/bsf.jar wrapper.classpath=/usr/local/lib/java/bsfengines.jar wrapper.classpath=/usr/local/lib/java/cocoon.jar wrapper.classpath=/usr/local/lib/java/fop.jar wrapper.classpath=/usr/local/lib/java/turbine-pool.jar wrapper.classpath=/usr/local/lib/java/xalan.jar wrapper.classpath=/usr/local/lib/java/xerces.jar wrapper.classpath=/usr/lib/pgsql/jdbc7.0-1.2.jar --- hi. we have just fixed this problem In this classpath, you should replace fop with fop_0_15_0 xalan with xalan_1_2_D02 xerces with xerces_1_2 and add sax-bugfix.jar - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: problems with xsp date
Thanks Jan, that worked. I'm new to xsp as you've probably guessed! Lisa -Original Message- From: Uyttenhove Jan [mailto:[EMAIL PROTECTED]] Sent: 13 June 2001 10:45 To: '[EMAIL PROTECTED]' Subject: RE: problems with xsp date Lisa, first, java.util.Date is included, but java.util.Calendar isn't. Try to include it by adding : xsp:structure xsp:includejava.util.Calendar/xsp:include /xsp:structure second, you should put your xsp:logic block inside your time block So, try this: xsp:structure xsp:includejava.util.Calendar/xsp:include /xsp:structure time xsp:logic Calendar now = Calendar.getInstance(); now.setTime( new Date() ); float hourAngle = (float) now.get( Calendar.HOUR ) / 12 * 360; float minAngle = (float) now.get( Calendar.MINUTE ) / 60 * 360; /xsp:logic hourxsp:exprhourAngle/xsp:expr/hour minutexsp:exprminAngle/xsp:expr/minute /time You can always check the Java code generated by the xsp, this sometimes helps to understand the error. Jan Jan Uyttenhove - Software Engineer - The E-corporation http://www.the-ecorp.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 11:28 To: [EMAIL PROTECTED] Subject: problems with xsp date Hi all I'm trying to create a simple XSP page that gets the current hour and minute and passes it on to a stylesheet. The cocoon docs say XSP automatically generates import statements for the most commonly used Java libraries (including java.util.Date). However when I try run the page I get an error: Type expected. now.setTime(new Date()); Has anybody got any ideas? Here is the relevant part of the page: xsp:logic Calendar now = Calendar.getInstance(); now.setTime( new Date() ); float hourAngle = (float) now.get( Calendar.HOUR ) / 12 * 360; float minAngle = (float) now.get( Calendar.MINUTE ) / 60 * 360; /xsp:logic time hourxsp:exprhourAngle/xsp:expr/hour minutexsp:exprminAngle/xsp:expr/minute /time thanks in advance! Lisa - 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: [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/faqs.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/faqs.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]