// Path: src/main/java/net/sourceforge/schemaspy/model/xml/TableMeta.java
// public class TableMeta {
//     private final String name;
//     private final String comments;
//     private final List<TableColumnMeta> columns = new ArrayList<TableColumnMeta>();
//     private final String remoteCatalog;
//     private final String remoteSchema;
//     private final List<AdditionalInfo> additionalInfo = new ArrayList<AdditionalInfo>();
// 
// 	private static final Logger logger = Logger.getLogger(TableMeta.class.getName());
// 
//     TableMeta(Node tableNode) {
//         NamedNodeMap attribs = tableNode.getAttributes();
// 
//         name = attribs.getNamedItem("name").getNodeValue();
// 
//         Node node = attribs.getNamedItem("comments");
//         if (node == null)
//             node = attribs.getNamedItem("remarks");
//         if (node != null) {
//             String tmp = node.getNodeValue().trim();
//             comments = tmp.length() == 0 ? null : tmp;
//         } else {
//             comments = null;
//         }
// 
//         node = attribs.getNamedItem("remoteSchema");
//         remoteSchema = node == null ? null : node.getNodeValue().trim();
// 
//         node = attribs.getNamedItem("remoteCatalog");
//         remoteCatalog = node == null ? null : node.getNodeValue().trim();
// 
//         logger.fine("Found XML table metadata for " + name +
//                     " remoteCatalog: " + remoteCatalog +
//                     " remoteSchema: " + remoteSchema +
//                     " comments: " + comments);
// 
//         NodeList columnNodes = ((Element)tableNode.getChildNodes()).getElementsByTagName("column");
// 
//         for (int i = 0; i < columnNodes.getLength(); ++i) {
//             Node colNode = columnNodes.item(i);
//             columns.add(new TableColumnMeta(colNode));
//         }
//         
//         NodeList additionalInfosNodes = ((Element)tableNode.getChildNodes()).getElementsByTagName("additionalInfos");
//         
//         for (int i = 0; i < additionalInfosNodes.getLength(); ++i) {
//         	NodeList additionalInfoNodes = ((Element)additionalInfosNodes.item(i).getChildNodes()).getElementsByTagName("additionalInfo");
//         	for (int j = 0; j < additionalInfoNodes.getLength(); ++j) {
//         		additionalInfo.add(new AdditionalInfo(additionalInfoNodes.item(j)));
//         	}
//             
//         }
//         
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getComments() {
//         return comments;
//     }
// 
//     public List<TableColumnMeta> getColumns() {
//         return columns;
//     }
// 
//     public String getRemoteCatalog() {
//         return remoteCatalog;
//     }
//     
//     public String getRemoteSchema() {
//         return remoteSchema;
//     }
//     
//     public List<AdditionalInfo> getAdditionalInfo() {
// 		return additionalInfo;
// 	}
// }


import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.schemaspy.Config;
import net.sourceforge.schemaspy.model.xml.SchemaMeta;
import net.sourceforge.schemaspy.model.xml.TableMeta;
import net.sourceforge.schemaspy.util.CaseInsensitiveMap;
    private void updateFromXmlMetadata(SchemaMeta schemaMeta) throws SQLException {
        if (schemaMeta != null) {
            config.setDescription(schemaMeta.getComments());

            // done in three passes:
            // 1: create any new tables
            // 2: add/mod columns
            // 3: connect

            // add the newly defined tables and columns first
            for (TableMeta tableMeta : schemaMeta.getTables()) {
                Table table;

                if (tableMeta.getRemoteSchema() != null || tableMeta.getRemoteCatalog() != null) {
                    // will add it if it doesn't already exist
                    table = addRemoteTable(tableMeta.getRemoteCatalog(), tableMeta.getRemoteSchema(), tableMeta.getName(), getSchema(), true);
                } else {
                    table = locals.get(tableMeta.getName());

                    if (table == null) {
                        // new table defined only in XML metadata
                        table = new LogicalTable(this, getCatalog(), getSchema(), tableMeta.getName(), tableMeta.getComments());
                        tables.put(table.getName(), table);
                    }
                }

                table.update(tableMeta);
            }

            // then tie the tables together
// Path: src/main/java/net/sourceforge/schemaspy/model/xml/TableMeta.java
// public class TableMeta {
//     private final String name;
//     private final String comments;
//     private final List<TableColumnMeta> columns = new ArrayList<TableColumnMeta>();
//     private final String remoteCatalog;
//     private final String remoteSchema;
//     private final List<AdditionalInfo> additionalInfo = new ArrayList<AdditionalInfo>();
// 
// 	private static final Logger logger = Logger.getLogger(TableMeta.class.getName());
// 
//     TableMeta(Node tableNode) {
//         NamedNodeMap attribs = tableNode.getAttributes();
// 
//         name = attribs.getNamedItem("name").getNodeValue();
// 
//         Node node = attribs.getNamedItem("comments");
//         if (node == null)
//             node = attribs.getNamedItem("remarks");
//         if (node != null) {
//             String tmp = node.getNodeValue().trim();
//             comments = tmp.length() == 0 ? null : tmp;
//         } else {
//             comments = null;
//         }
// 
//         node = attribs.getNamedItem("remoteSchema");
//         remoteSchema = node == null ? null : node.getNodeValue().trim();
// 
//         node = attribs.getNamedItem("remoteCatalog");
//         remoteCatalog = node == null ? null : node.getNodeValue().trim();
// 
//         logger.fine("Found XML table metadata for " + name +
//                     " remoteCatalog: " + remoteCatalog +
//                     " remoteSchema: " + remoteSchema +
//                     " comments: " + comments);
// 
//         NodeList columnNodes = ((Element)tableNode.getChildNodes()).getElementsByTagName("column");
// 
//         for (int i = 0; i < columnNodes.getLength(); ++i) {
//             Node colNode = columnNodes.item(i);
//             columns.add(new TableColumnMeta(colNode));
//         }
//         
//         NodeList additionalInfosNodes = ((Element)tableNode.getChildNodes()).getElementsByTagName("additionalInfos");
//         
//         for (int i = 0; i < additionalInfosNodes.getLength(); ++i) {
//         	NodeList additionalInfoNodes = ((Element)additionalInfosNodes.item(i).getChildNodes()).getElementsByTagName("additionalInfo");
//         	for (int j = 0; j < additionalInfoNodes.getLength(); ++j) {
//         		additionalInfo.add(new AdditionalInfo(additionalInfoNodes.item(j)));
//         	}
//             
//         }
//         
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getComments() {
//         return comments;
//     }
// 
//     public List<TableColumnMeta> getColumns() {
//         return columns;
//     }
// 
//     public String getRemoteCatalog() {
//         return remoteCatalog;
//     }
//     
//     public String getRemoteSchema() {
//         return remoteSchema;
//     }
//     
//     public List<AdditionalInfo> getAdditionalInfo() {
// 		return additionalInfo;
// 	}
// }


// Path: src/main/java/net/sourceforge/schemaspy/model/Database.java
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.schemaspy.Config;
import net.sourceforge.schemaspy.model.xml.SchemaMeta;
import net.sourceforge.schemaspy.model.xml.TableMeta;
import net.sourceforge.schemaspy.util.CaseInsensitiveMap;

    private void updateFromXmlMetadata(SchemaMeta schemaMeta) throws SQLException {
        if (schemaMeta != null) {
            config.setDescription(schemaMeta.getComments());

            // done in three passes:
            // 1: create any new tables
            // 2: add/mod columns
            // 3: connect

            // add the newly defined tables and columns first
            for (TableMeta tableMeta : schemaMeta.getTables()) {
                Table table;

                if (tableMeta.getRemoteSchema() != null || tableMeta.getRemoteCatalog() != null) {
                    // will add it if it doesn't already exist
                    table = addRemoteTable(tableMeta.getRemoteCatalog(), tableMeta.getRemoteSchema(), tableMeta.getName(), getSchema(), true);
                } else {
                    table = locals.get(tableMeta.getName());

                    if (table == null) {
                        // new table defined only in XML metadata
                        table = new LogicalTable(this, getCatalog(), getSchema(), tableMeta.getName(), tableMeta.getComments());
                        tables.put(table.getName(), table);
                    }
                }

                table.update(tableMeta);
            }

            // then tie the tables together
            for (TableMeta tableMeta : schemaMeta.getTables()) {