[Announce] Koala XML activities

Philippe Le Hégaret Philippe.Le_Hegaret at sophia.inria.fr
Tue Sep 22 10:28:21 BST 1998


Hello,

 I am please to announce a new XML service on the Web.
  http://koala.inria.fr:8080/

 The goal of the Koala XML services is to show our
current work on XML.
 Current services are :

 - an XML validation service. This is my own work.
the current version has some troubles with entities.

 - an XSL engine by Jeremy Calles.
the current version doesn't support formatting objects 
yet. This web service can be invoked directly by the
XSLOnline Java program (see attachment).

 Hope you will find this helpful,

Jeremy Calles and Philippe Le Hegaret.
-------
Have fun with Koalas! :-)
http://www.inria.fr/koala/
-------------- next part --------------
import java.net.*;
import java.io.*;

/**
 * This class is a little tool to invoke the XSLEngine.
 * 
 */
public class XSLOnline {

    public static String baseURL = "http://koala.inria.fr:8080/Java/XSLEngine?";

    public static void main(String[] args) {
	try {
	    if ((!args[0].equals("-r")) || (args.length > 3)) {
		throw new ArrayIndexOutOfBoundsException();
	    }
	    String command = "";
	    command += "XMLuri=" + args[2];
	    command += "&XSLuri=" + args[1];
	    
	    URL url = new URL(baseURL + command);

	    InputStream in = openStream(url);
	    int i = 0;
	    
	
	    while ((i = in.read()) != -1) {
		System.err.print( (char) i );
	    }
	} catch (ArrayIndexOutOfBoundsException e) {
	    System.err.println("XSLOnline v 1.0 - "
			       + "jcalles at sophia.inria.fr");
	    System.err.println("Usage: -r xslUrl [xmlUrl]");
	} catch (FileNotFoundException e) {
	    System.err.println("File not found: " + e.getMessage());
	} catch (IOException e) {
	    System.err.println("I/O Error: " + e.getMessage());
	} catch (Exception e) {
	    System.err.println("Error: ");
	    System.err.println(e.toString());
	}
    }

    private static InputStream openStream(URL url) throws IOException {
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestProperty("Pragma", "no-cache"); // @@deprecated
        connection.setRequestProperty("Cache-Control", "no-cache");
        connection.setRequestProperty("Accept", "text/plain");
        connection.setRequestProperty("User-Agent", "Koala_XSLOnline/1.0");

	if (connection.getResponseCode() !=  HttpURLConnection.HTTP_OK) {
	    if (connection.getResponseMessage() != null) {
		throw new IOException(url + ": " + 
				      connection.getResponseMessage());
	    } else {
		throw new IOException(url + ": " + 
				      connection.getResponseCode());
	    }
	}
	return connection.getInputStream();
    }
}


More information about the Xml-dev mailing list