You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by cib <c....@laposte.net> on 2001/09/15 18:33:52 UTC

Xsp logic help C2

hi,
I can't get to write the output.txt file from this xsp on Cocoon2

<?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">
<xsp:logic>
public class WriteMe {
      public static void main(String args[])
      {
try { //try to read from url
URL myurl = new URL( "http://localhost/cocoon/test/a1.html" );
BufferedInputStream inn = new BufferedInputStream(myurl.openStream());
BufferedWriter out = new BufferedWriter( new OutputStreamWriter( new
FileOutputStream("output.txt") ) );
for(;;) {
     int data = inn.read();
if (data == -1) {
break;
}
else {
out.write((char) data);
}
}
out.flush();
}
catch(MalformedURLException mue) { System.out.println("Invalid URL");}
catch(IOException ioe) { System.out.println("I/O Error - " + ioe);}
}
</xsp:logic>
  <page>

<xsp:expr>WriteMe()</xsp:expr>
make 1 xsp
  </page>
</xsp:page>

I only get a blank page:
The serialiser seems to work, but the xsl isn't applied and no output txt is
created.
If someone sees my mistake.

Cib

France, Bordeaux, xml and gay pride.


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