You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Russell Castagnaro <ru...@synctank.com> on 2000/05/24 10:43:53 UTC
Trouble with JSP/ XML compatibility
Hi,
I'm trying to make a jsp that can also include some transformed XML, since I'm
using GNUJSP I can't use the servlet 2.2 API :(
here's what I'm using to do the transformation in my JSP (this works great in a
servlet):
<jsp:declaration>
public void displayXML(Writer _out, String _path,String _xml, String _xsl)
throws Exception
{
if (_out == null) throw new Exception("No Writer specified");
PrintWriter out = new PrintWriter(_out);
// find out what doc and stylesheet we're dealing with here
if (_xml == null) throw new Exception("No XML file specified");
if (_xsl == null) throw new Exception("No XSL file specified");
// Get the XML Document
File xmlFile = new File(_path,_xml);
File xslFile = new File(_path,_xsl);
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
processor.process(new XSLTInputSource(new FileReader(xmlFile)),
new XSLTInputSource(new FileReader(xslFile)),
new XSLTResultTarget(out));
}
</jsp:declaration>
then to call it in the jsp:
<jsp:scriptlet>
try{
displayXML(out,"/iws/wwwroot/mysuff","property.xml","xsl/property_html_1.xsl");
} catch (Exception e) {
e.printStackTrace(new PrintWriter(out));
}
</jsp:scriptlet>
however this is the result!!!
org.apache.xalan.xslt.XSLProcessorException: The element type "xsp:page" must be
terminated by the
matching end-tag "". at
org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630) at
org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.java:852)
at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java, Compiled
Code) at
jsp___2fmyhawaiiproperty_2fproperty_2ejsp.displayXML(jsp___2fmyhawaiiproperty_2fproperty_2ejsp.java:35)
at
jsp___2fmyhawaiiproperty_2fproperty_2ejsp._jspService(jsp___2fmyhawaiiproperty_2fproperty_2ejsp.java:97)
at org.gjt.jsp.HttpJspPageImpl.service(HttpJspPageImpl.java:75)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at
org.gjt.jsp.JspServlet$Page.process(JspServlet.java, Compiled Code)
at
org.gjt.jsp.JspServlet.service(JspServlet.java:284) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at
stec.iws.RequestHandler.process_servlet(RequestHandler.java) at
stec.iws.RequestHandler.process_servlet(RequestHandler.java) at
stec.iws.RequestHandler.nextRequest(RequestHandler.java) at
stec.iws.RequestHandler.processRequest(RequestHandler.java, Compiled
Code) at
stec.iws.RequestHandler.run(RequestHandler.java, Compiled Code) at
java.lang.Thread.run(Thread.java:479) ---------
org.xml.sax.SAXParseException: The element type
"xsp:page" must be terminated by the matching end-tag "". at
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1318)
at
org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocumentScanner.java:625)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.endOfInput(XMLDocumentScanner.java:1448)
at
org.apache.xerces.framework.XMLDocumentScanner.endOfInput(XMLDocumentScanner.java:411)
at
org.apache.xerces.framework.XMLParser.sendEndOfInputNotifications(XMLParser.java:2369)
at
org.apache.xerces.framework.XMLParser.changeReaders(XMLParser.java:2911)
at
org.apache.xerces.readers.XMLEntityReader.changeReaders(XMLEntityReader.java:164)
at
org.apache.xerces.readers.AbstractCharReader.changeReaders(AbstractCharReader.java:149)
at
org.apache.xerces.readers.AbstractCharReader.scanContent(AbstractCharReader.java,
Compiled
Code) at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java,
Compiled Code) at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java,
Compiled Code) at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1208) at
org.apache.xalan.xpath.dtm.DTMLiaison.parse(DTMLiaison.java:229) at
org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.java:838)
at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java, Compiled
Code) at
jsp___2fmyhawaiiproperty_2fproperty_2ejsp.displayXML(jsp___2fmyhawaiiproperty_2fproperty_2ejsp.java:35)
at
jsp___2fmyhawaiiproperty_2fproperty_2ejsp._jspService(jsp___2fmyhawaiiproperty_2fproperty_2ejsp.java:97)
at org.gjt.jsp.HttpJspPageImpl.service(HttpJspPageImpl.java:75)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at
org.gjt.jsp.JspServlet$Page.process(JspServlet.java, Compiled Code)
at
org.gjt.jsp.JspServlet.service(JspServlet.java:284) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at
stec.iws.RequestHandler.process_servlet(RequestHandler.java) at
stec.iws.RequestHandler.process_servlet(RequestHandler.java) at
stec.iws.RequestHandler.nextRequest(RequestHandler.java) at
stec.iws.RequestHandler.processRequest(RequestHandler.java, Compiled
Code) at
stec.iws.RequestHandler.run(RequestHandler.java, Compiled Code) at
java.lang.Thread.run(Thread.java:479)
Icky eh?
Anyone have any insights into this? I'm not using XSP anywhere in here, so I
really don't understand why XSP:Page is needed.
Thanks!
Russell
--
Hope to see you at my presentation, "Making the Most of XML, XSL and Server-Side
Processing"
at XML DevCon 2000, June 25-28, 2000.
Russell Castagnaro
Chief Mentor
SyncTank Solutions
http://www.synctank.com
Earth is the cradle of mankind; one does not remain in the cradle forever
-Tsiolkovsky