FileDocCategorySizeDatePackage
XmlForm.javaAPI DocExample1575Sat Nov 25 12:56:34 GMT 2000None

XmlForm

public class XmlForm extends Object
Convert a simple XML file to text.
author
Ian Darwin, ian@darwinsys.com
version
$Id: XmlForm.java,v 1.17 2000/11/25 17:56:34 ian Exp $

Fields Summary
protected Reader
is
protected String
fileName
protected static PrintStream
msg
Constructors Summary
public XmlForm(String fn)
Construct a converter given an input filename


	        
	   
		fileName = fn;
	
Methods Summary
public voidconvert(boolean verbose)
Convert the file

		try {
			if (verbose)
				System.err.println(">>>Parsing " + fileName + "...");
			// Make the document a URL so relative DTD works.
			String uri = "file:" + new File(fileName).getAbsolutePath();
			XmlDocument doc = XmlDocument.createXmlDocument(uri);
			if (verbose)
				System.err.println(">>>Walking " + fileName + "...");
			XmlFormWalker c = new GenMIF(doc, msg);
			c.convertAll();

		} catch (Exception ex) {
			System.err.println("+================================+");
			System.err.println("|         *Parse Error*          |");
			System.err.println("+================================+");
			System.err.println(ex.getClass());
			System.err.println(ex.getMessage());
			System.err.println("+================================+");
		}
		if (verbose)
			System.err.println(">>>Done " + fileName + "...");
	
public static voidmain(java.lang.String[] av)

		if (av.length == 0) {
			System.err.println("Usage: XmlForm file");
			return;
		}
		for (int i=0; i<av.length; i++) {
			String name = av[i];
			new XmlForm(name).convert(true);
		}
		msg.close();