CISC370-011 -- demo code from class #12

This page provides links to some sample code from class #12 (Nov 25).

P1.java is a simple demonstration of SAX. It reads an XML version of Shakespeare's "A Midsummer Night's Dream", then prints all Act and Scene titles and stage directions, with indentation indicating the nesting of the XML document. A copy of the play is here and its DTD is here.

P2.java performs the same task as P1.java, using the DOM API instead of SAX.

P3.java applies an XSLT stylesheet to another Shakespeare play to render it in HTML. (Here is the CSS stylesheet which formats the HTML.)

P4.java builds a DOM tree representing a directory hierarchy, then uses an XSL stylesheet to format it as HTML.

Bserver.java uses the Apache XML-RPC library to implement a simple XML-RPC server with several handlers. The default handler, an instance of class BHandler, implements a shared associative array with methods put(name,value) and get(name). This handler is also responsible for shutting down the Web server when a special method (die()) is invoked. A second handler, an instance of class RHandler, is registered under the name other. Its single method, reverse(), which returns its single string argument reversed, must be called using the method name "other.reverse".

Bclient.java is a client program which tests Bserver.java.