You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Yves Vindevogel <yv...@implements.be> on 2002/12/12 14:26:46 UTC

Include content of another (non-xml) file into an XSP

Hi,

I'm looking for a way to include the complete content of a text file into an 
XSP page.
This is an example page :

<?xml version="1.0" encoding="ISO-8859-1"?>

    <xsp:page language="java"
    			xmlns:xsp="http://apache.org/xsp"
			xmlns:esql="http://apache.org/cocoon/SQL/v2"
			xmlns:xsp-request="http://apache.org/xsp/request/2.0"
			xmlns:xsp-session="http://apache.org/xsp/session/2.0"
			create-session="true">

        <html>
            <esql:connection>
                <esql:pool>pierrefabre</esql:pool>

                <esql:execute-query>
			<esql:query>
				HERE COMES THE CONTENT OF THE FILE WITH NAME mySQLQuery.sql				
			</esql:query>

                    	<esql:results>
				<!-- Handle results -->
		    	</esql:results>

                        <esql:no-results>
                        	<!-- Handle no results -->
                        </esql:no-results>
                </esql:execute-query>
            </esql:connection>
        </html>
    </xsp:page>


This would allow me to create one template for executing all my queries.  I 
can then store them into single .sql files.  When I ever need a different 
interaction with my database (handling errors, no results, ...), I only need 
to modify one template instead of a set of XSP files.

I wrote code in Java, to open an InputStream and create the file.
That worked.  Porting my code to Cocoon didn't.  I always get some error. 
Some code example would be great.  



---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


AW: Include content of another (non-xml) file into an XSP

Posted by Marco Rolappe <m_...@web.de>.
hi yves,

maybe you could simply use one of the Cocoon IncludeTransformers, so that
your text file is included before the XSP is compiled and executed.


-----Ursprungliche Nachricht-----
Von: cocoon-users-return-43760-m_rolappe=web.de@xml.apache.org
[mailto:cocoon-users-return-43760-m_rolappe=web.de@xml.apache.org]Im
Auftrag von Yves Vindevogel
Gesendet: Donnerstag, 12. Dezember 2002 14:27
An: cocoon-users@xml.apache.org
Betreff: Include content of another (non-xml) file into an XSP


Hi,

I'm looking for a way to include the complete content of a text file into an
XSP page.
This is an example page :

<?xml version="1.0" encoding="ISO-8859-1"?>

    <xsp:page language="java"
    			xmlns:xsp="http://apache.org/xsp"
			xmlns:esql="http://apache.org/cocoon/SQL/v2"
			xmlns:xsp-request="http://apache.org/xsp/request/2.0"
			xmlns:xsp-session="http://apache.org/xsp/session/2.0"
			create-session="true">

        <html>
            <esql:connection>
                <esql:pool>pierrefabre</esql:pool>

                <esql:execute-query>
			<esql:query>
				HERE COMES THE CONTENT OF THE FILE WITH NAME mySQLQuery.sql
			</esql:query>

                    	<esql:results>
				<!-- Handle results -->
		    	</esql:results>

                        <esql:no-results>
                        	<!-- Handle no results -->
                        </esql:no-results>
                </esql:execute-query>
            </esql:connection>
        </html>
    </xsp:page>



---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>