You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matthias Barmeier <ba...@BARMEIER.COM> on 2000/06/02 14:13:29 UTC

Nested loops and tags

Hi,

I have read the XSP manual page and I have looked at the samples
delivered with cocoon, but I don't know if this is a must or not.

The Problem:

I would like to read a txt-File detokenize it and put in a table.
this code snippet works fine.

	<xsp:logic>
		BufferedReader in = new BufferedReader (new FileReader ("c:\\motor.txt"));
		String line=new String();
		String gkb = new String();

		while ((line = in.readLine()) != null) {

    		line=line.trim();
		StringTokenizer st=new StringTokenizer (line, " ");
	</xsp:logic>
	<gkbline>
	<xsp:logic>
		while (st.hasMoreTokens()){
    			gkb=st.nextToken();
				<csv><xsp:content><xsp:expr>gkb</xsp:expr></xsp:content></csv>
    		}
	</xsp:logic>
	</gkbline>
	<xsp:logic>
		}
    	</xsp:logic>

I have to break up the xsp:logic in three parts because the following does
not work:

	<xsp:logic>
		BufferedReader in = new BufferedReader (new FileReader ("c:\\motor.txt"));
		String line=new String();
		String gkb = new String();

		while ((line = in.readLine()) != null) {

    		line=line.trim();
		StringTokenizer st=new StringTokenizer (line, " ");
	<gkbline>
		while (st.hasMoreTokens()){
    			gkb=st.nextToken();
				<csv><xsp:content><xsp:expr>gkb</xsp:expr></xsp:content></csv>
    		}
	</gkbline>
		}
    	</xsp:logic>


I have fooled arounf with the xsp:content tag but nothing worked. I always
get the code between
gkbline and /gkbline and not the xsp:logic results.

Where is my fault ??

/*
    Dipl.-Inform. Matthias Barmeier        Tel: +49 (0)30 79 70 72 87
    Büro für Softwareentwicklung           Fax +49 (0)30 79 70 72 88
    Grunewaldstr. 18                       Email: barmeier@barmeier.com
    12165 Berlin                           WWW: <http://www.barmeier.com>
*/