You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jens Lorenz <je...@interface-business.de> on 2000/08/16 16:35:40 UTC

Suggestion for src/org/apache/cocoon/processor/xsp/xsp-java.xsl (v1.17)

Hi Cocoon Developers,


while using Cocoon for developing an XSP-Taglib I suffered rather big
problems.

The import statements compiled bei default into the java source of the
XSPPage subclass conflicted with my own (user) imports ... (this took
me several days to figure out)
(to be more precise: XSP imports org.w3c.dom.Document and I need
oracle.ifs.beans.Document, which have completly different
functionality ... the goal is to have an XSP taglib providing a
content and document managment system - like Oracle iFS - to XSP pages)

There were classes with the same names but different packages ... This
seems to confuse the java compiler while importing
with <package-name>.* ...

Because the a fairly big amount of my own source won't use any DOM
classes or other Cocoon related classes I rewrote the file
src/org/apache/cocoon/processor/xsp/xsp-java.xsl to only use import
statements without an * and only full qualified class names ... This
way I don't have to bother with Cocoon internals and I am able to
develop the java code in the XSP pages straight forward ...

It was the file version 1.17 of xsp-java.xsl (according to the WebCVS)
included in Cocoon 1.7.4 ... a diff follows ...


72,85c72,79
<     import java.io.*;
<     import java.net.*;
<     import java.util.*;
<     import org.w3c.dom.*;
<     import org.xml.sax.*;
<     import javax.servlet.*;
<     import javax.servlet.http.*;
<
<     import org.apache.cocoon.parser.*;
<     import org.apache.cocoon.producer.*;
<     import org.apache.cocoon.framework.*;
<
<     import org.apache.cocoon.processor.xsp.*;
<     import org.apache.cocoon.processor.xsp.library.*;
---
>     import java.util.Stack;
>     import org.w3c.dom.Document;
>     import org.w3c.dom.Element;
>     import org.w3c.dom.Node;
>     import javax.servlet.http.HttpServletRequest;
>     import javax.servlet.http.HttpServletResponse;
>     import javax.servlet.http.HttpSession;
>     import org.apache.cocoon.processor.xsp.XSPPage;
92c86
<     public class <xsl:value-of select="@name"/> extends XSPPage {
---
>     public class <xsl:value-of select="@name"/> extends
org.apache.cocoon.processor.xsp.XSPPage {
97,99c91,93
<         HttpServletRequest request,
<         HttpServletResponse response,
<         Document document
---
>         javax.servlet.http.HttpServletRequest request,
>         javax.servlet.http.HttpServletResponse response,
>         org.w3c.dom.Document document
101c95
<         throws Exception
---
>         throws java.lang.Exception
104,106c98,100
<         Node xspParentNode = null;
<         Node xspCurrentNode = document;
<         Stack xspNodeStack = new Stack();
---
>         org.w3c.dom.Node xspParentNode = null;
>         org.w3c.dom.Node xspCurrentNode = document;
>         java.util.Stack xspNodeStack = new java.util.Stack();
116c110
<         HttpSession session = request.getSession(<xsl:value-of
select="$create-session"/>);
---
>         javax.servlet.http.HttpSession session =
request.getSession(<xsl:value-of select="$create-session"/>);
143,144c137,138
<     ((Element) xspCurrentNode).normalize();
<     xspCurrentNode = (Node) xspNodeStack.pop();
---
>     ((org.w3c.dom.Element) xspCurrentNode).normalize();
>     xspCurrentNode = (org.w3c.dom.Node) xspNodeStack.pop();
148c142
<     ((Element) xspCurrentNode).setAttribute(
---
>     ((org.w3c.dom.Element) xspCurrentNode).setAttribute(
231,232c225,226
<     ((Element) xspCurrentNode).normalize();
<     xspCurrentNode = (Node) xspNodeStack.pop();
---
>     ((org.w3c.dom.Element) xspCurrentNode).normalize();
>     xspCurrentNode = (org.w3c.dom.Node) xspNodeStack.pop();
243c237
<     ((Element) xspCurrentNode).setAttribute(
---
>     ((org.w3c.dom.Element) xspCurrentNode).setAttribute(
264,267c258,261
<     Node xspParentNode = null;
<     Node xspCurrentNode = <xsl:value-of select="@node-argument"/>;
<     Stack xspNodeStack = new Stack();
<     Document document = <xsl:value-of
select="@node-argument"/>.getOwnerDocument();
---
>     org.w3c.dom.Node xspParentNode = null;
>     org.w3c.dom.Node xspCurrentNode = <xsl:value-of
select="@node-argument"/>;
>     Stack xspNodeStack = new java.util.Stack();
>     org.w3c.dom.Document document = <xsl:value-of
select="@node-argument"/>.getOwnerDocument();



Best Regards,

Jens