Beispiel #1
0
  public void endDTD() throws SAXException {
    logger.debug("endDTD() - start");

    try {
      if (_rootModel == null) {
        logger.info("The rootModel is null. Cannot add tables.");
      } else {
        if (ANY.equalsIgnoreCase(_rootModel)) {
          Iterator i = _columnListMap.keySet().iterator();
          while (i.hasNext()) {
            String tableName = (String) i.next();
            addTable(tableName);
          }
        } else {
          // Remove enclosing model parenthesis
          String rootModel = _rootModel.substring(1, _rootModel.length() - 1);

          // Parse the root element model to determine the table sequence.
          // Support all sequence or choices model but not the mix of both.
          String delim = (rootModel.indexOf(",") != -1) ? "," : "|";
          StringTokenizer tokenizer = new StringTokenizer(rootModel, delim);
          while (tokenizer.hasMoreTokens()) {
            String tableName = tokenizer.nextToken();
            tableName = cleanupTableName(tableName);
            addTable(tableName);
          }
        }
      }

      _consumer.endDataSet();
    } catch (DataSetException e) {
      throw new SAXException(e);
    }
  }
Beispiel #2
0
  public void startDTD(String name, String publicId, String systemId) throws SAXException {
    if (logger.isDebugEnabled()) {
      logger.debug(
          "startDTD(name={}, publicId={}, systemId={}) - start",
          new Object[] {name, publicId, systemId});
    }

    try {
      _rootName = name;
      _consumer.startDataSet();
    } catch (DataSetException e) {
      throw new SAXException(e);
    }
  }
Beispiel #3
0
 private void addTable(String tableName) throws DataSetException {
   Column[] columns = getColumns(tableName);
   _consumer.startTable(new DefaultTableMetaData(tableName, columns));
   _consumer.endTable();
 }