org.apache.torque.engine.database.transform
Class XmlToAppData

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--org.apache.torque.engine.database.transform.XmlToAppData
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XmlToAppData
extends org.xml.sax.helpers.DefaultHandler

A Class that is used to parse an input xml schema file and creates an AppData java structure.

Version:
$Id: XmlToAppData.java,v 1.13 2002/04/11 22:02:06 mpoeschl Exp $
Author:
Leon Messerschmidt, Jason van Zyl, Martin Poeschl, Daniel Rall

Field Summary
private  AppData app
           
private  Column currColumn
           
private  Database currDB
           
private  ForeignKey currFK
           
private  Index currIndex
           
private  Table currTable
           
private  Unique currUnique
           
private static boolean DEBUG
          enables debug output
private  java.lang.String errorMessage
           
private  boolean firstPass
           
private  Table foreignTable
           
private static javax.xml.parsers.SAXParserFactory saxFactory
           
 
Constructor Summary
XmlToAppData(java.lang.String databaseType, java.lang.String basePropsFilePath)
          Creates a new instance for the specified database type.
 
Method Summary
(package private) static void ()
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String rawName)
          Handles closing elements of the xml file.
 void error(org.xml.sax.SAXParseException spe)
          Error callback.
 void fatalError(org.xml.sax.SAXParseException spe)
          Fatal error callback.
 AppData parseFile(java.lang.String xmlFile)
          Parses a XML input file and returns a newly created and populated AppData structure.
private  void printParseError(java.lang.String type, org.xml.sax.SAXParseException spe)
           
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          EntityResolver implementation.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes attributes)
          Handles opening elements of the xml file.
 void warning(org.xml.sax.SAXParseException spe)
          Warning callback.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
enables debug output

app

private AppData app

currDB

private Database currDB

currTable

private Table currTable

currColumn

private Column currColumn

currFK

private ForeignKey currFK

currIndex

private Index currIndex

currUnique

private Unique currUnique

firstPass

private boolean firstPass

foreignTable

private Table foreignTable

errorMessage

private java.lang.String errorMessage

saxFactory

private static javax.xml.parsers.SAXParserFactory saxFactory
Constructor Detail

XmlToAppData

public XmlToAppData(java.lang.String databaseType,
                    java.lang.String basePropsFilePath)
Creates a new instance for the specified database type.
Parameters:
databaseType - The type of database for the application.
basePropsFilePath - The base of the path to the properties file, including trailing slash.
Method Detail

static void ()

parseFile

public AppData parseFile(java.lang.String xmlFile)
Parses a XML input file and returns a newly created and populated AppData structure.
Parameters:
xmlFile - The input file to parse.
Returns:
AppData populated by xmlFile.

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
EntityResolver implementation. Called by the XML parser
Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler
Returns:
an InputSource for the database.dtd file

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String rawName,
                         org.xml.sax.Attributes attributes)
Handles opening elements of the xml file.
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String rawName)
Handles closing elements of the xml file.
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler

warning

public void warning(org.xml.sax.SAXParseException spe)
Warning callback.
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
Parameters:
spe - The parse exception that caused the callback to be invoked.

error

public void error(org.xml.sax.SAXParseException spe)
Error callback.
Overrides:
error in class org.xml.sax.helpers.DefaultHandler
Parameters:
spe - The parse exception that caused the callback to be invoked.

fatalError

public void fatalError(org.xml.sax.SAXParseException spe)
Fatal error callback.
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
Parameters:
spe - The parse exception that caused the callback to be invoked.

printParseError

private final void printParseError(java.lang.String type,
                                   org.xml.sax.SAXParseException spe)


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.