001// ReaderDemo.java: demonstration application showing Æfred's reader stream.
002// NO WARRANTY! See README, and copyright below.
003// $Id$
004// Modified 11/8/98 to add package statement.
005package com.microstar.xml.demo;
006
007import java.io.Reader;
008import java.io.StringReader;
009
010import com.microstar.xml.XmlParser;
011
012/**
013 * Demonstration application showing Æfred's event stream from a stream.
014 * <p>Usage: <code>java StreamDemo</code>
015 * @author Copyright (c) 1998 by Microstar Software Ltd.;
016 * @author written by David Megginson &lt;dmeggins@microstar.com&gt;
017 * @version 1.1
018 * @since Ptolemy II 0.2
019 * @see com.microstar.xml.XmlParser
020 * @see com.microstar.xml.XmlHandler
021 * @see XmlApp
022 * @see EventDemo
023 */
024public class ReaderDemo extends EventDemo {
025    public static void main(String[] args) throws Exception {
026        ReaderDemo handler = new ReaderDemo();
027        Reader reader;
028
029        if (args.length != 0) {
030            System.err.println("Usage: java ReaderDemo");
031            System.exit(1);
032        }
033
034        reader = new StringReader(
035                "<doc>\n<title>Sample</title>\n<p n=\"1\">Sample document</p>\n</doc>\n");
036
037        XmlParser parser = new XmlParser();
038        parser.setHandler(handler);
039        parser.parse(null, null, reader);
040    }
041}