Schema { public static CDDef readDefinition(ClassGraph cg, String fileName) throws Exception {{ return readDefinition(cg, fileName, null); }} public static CDDef readDefinition(ClassGraph cg, String fileName, CDDef def) throws Exception {{ Schema schema; // Open the specified schema-definition file and parse its contents to // create the schema object. But before parsing it, pre-process it to // remove comments, etc. and make changes necessary for the parser. try { BufferedReader reader = new BufferedReader(new FileReader(fileName)); schema = parse(Preprocessor.preProcessSchemaDefinition(reader)); } catch (FileNotFoundException e) { throw new Exception("Schema definition file '" + fileName + "'" + " not accessible."); } catch (IOException e) { throw new Exception("Error in reading schema definition file '" + fileName + "'"); } /* schema.print(); System.out.println(); */ // Create an empty CDDef object if none already exists if (def == null) def = CDDef.parse(" ( ) ( )"); // Traverse the schema object to extract the element, attribute and // type definitions TraversalGraph tg = new TraversalGraph("from Schema bypassing -> *,tail,* to *", cg); SchemaVisitor sv = new SchemaVisitor(def); tg.traverse(schema, sv); String namespacePrefixes[] = sv.getNamespacePrefix(); /* def.print(); System.out.println(); System.out.println("Namespace prefix = '" + namespacePrefixes[0] + "'."); */ return def; }} public void print() bypassing -> *,tail,* to * (DisplayVisitor); }