DatabaseXmlUtil { public static Database read(String filename) { return read(new File(filename)); } private  DatabaseXmlUtil(); static Database read(String filename); static Database read(File file); static Database read(InputStream is); static Database read(Reader reader); static Database read(Reader reader, boolean validate); static Table nextTable(XmlPullParser parser); static Table nextTable(XmlPullParser parser, String catalog, String schema); static void write(Database model, String filename); static void write(Database model, OutputStream output); static void write(Database model, Writer output); static String toXml(Table table); static String toXml(Database db); static boolean isOracle(Column column); static void write(Table table, Writer output); static String writeForeignKeyOnUpdateClause(ForeignKey fk); static String writeForeignKeyOnDeleteClause(ForeignKey fk); static final String DTD_PREFIX; }
@Test public void testReadXml() { Database database = DatabaseXmlUtil.read(getClass().getResourceAsStream("/testDatabaseIO.xml")); assertNotNull(database); assertEquals(2, database.getTableCount()); assertEquals("test", database.getName()); Table table = database.getTable(0); assertEquals("test_simple_table", table.getName()); assertEquals(8, table.getColumnCount()); assertEquals(1, table.getPrimaryKeyColumnCount()); assertEquals("id", table.getPrimaryKeyColumnNames()[0]); Table tableWithAmp = database.getTable(1); assertEquals("testColumnWith&", tableWithAmp.getName()); assertEquals("&Amp", tableWithAmp.getColumn(0).getName()); }