/* Copyright (C) 2005 Tresys Technology, LLC * License: refer to COPYING file for license information. * Authors: Spencer Shimko * * Docgen.java: The reference policy xml analyzer and documentation generator */ import policy.*; import java.io.*; import java.util.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Schema; import javax.xml.XMLConstants; import org.xml.sax.*; import org.w3c.dom.*; /** * The reference policy documentation generator and xml analyzer class. * It pulls in XML describing reference policy, transmogrifies it, * and spits it back out in some other arbitrary format. */ public class Docgen{ // store the PIs here private static Vector procInstr = new Vector(); private static boolean verbose = false; // the policy structure built after xml is parsed private Policy policy = null; // the xml document private Document dom = null; // the files/directories passed in from the command line private static File xmlFile; private static File headerFile; private static File footerFile; private static File outputDir; private static void printUsage(){ System.out.println("Reference Policy Documentation Compiler usage:"); System.out.println("\tjava -cp ./src Docgen [-h] [-v] -xf xmlFileIn -hf headerFile -ff footerFile -od outDirectory"); System.out.println("-h display this message and exit"); System.out.println("-xf XML file to parse"); System.out.println("-hf header file for HTML output"); System.out.println("-ff footer file for HTML output"); System.out.println("-od output directory"); System.exit(1); } /** * Docgen constructor * * @param output Filename to setup for output */ public Docgen(String output) throws FileNotFoundException { } /** * The main() driver for the policy documentation generator. * @param argv Arguments, takes 1 filename parameter */ public static void main(String argv[]) { if (argv.length == 0){ printUsage(); System.exit(1); } // hacked up version of getopt() for (int x=0; x < argv.length; x++){ if (argv[x].equals("-xf")){ x++; if (x