|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xml.sax.helpers.DefaultHandler org.apache.torque.engine.database.transform.XmlToAppData
public class XmlToAppData
A Class that is used to parse an input xml schema file and creates a Database java structure.
Nested Class Summary | |
---|---|
private static class |
XmlToAppData.ParseStackElement
When parsing multiple files that use nested |
Field Summary | |
---|---|
private Vector |
alreadyReadFiles
remember all files we have already parsed to detect looping. |
private Column |
currColumn
|
private String |
currentPackage
|
private String |
currentXmlFile
|
private ForeignKey |
currFK
|
private Index |
currIndex
|
private Table |
currTable
|
private Unique |
currUnique
|
private Database |
database
|
private String |
defaultPackage
|
private boolean |
firstPass
|
private boolean |
isExternalSchema
|
private static org.apache.commons.logging.Log |
log
Logging class from commons.logging |
private Stack |
parsingStack
this is the stack to store parsing data |
private static SAXParserFactory |
saxFactory
|
Constructor Summary | |
---|---|
XmlToAppData(String databaseType)
Creates a new instance for the specified database type. |
|
XmlToAppData(String databaseType,
String defaultPackage)
Creates a new instance for the specified database type. |
Method Summary | |
---|---|
void |
endElement(String uri,
String localName,
String rawName)
Handles closing elements of the xml file. |
void |
error(SAXParseException e)
Handles exception which occur when the xml file is parsed |
Database |
parseResource(String xmlFile)
Parses a XML input file and returns a newly created and populated Database structure. |
InputSource |
resolveEntity(String publicId,
String systemId)
EntityResolver implementation. |
void |
setOption(Attributes attributes)
|
void |
startElement(String uri,
String localName,
String rawName,
Attributes attributes)
Handles opening elements of the xml file. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
characters, endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static org.apache.commons.logging.Log log
private Database database
private Table currTable
private Column currColumn
private ForeignKey currFK
private Index currIndex
private Unique currUnique
private boolean firstPass
private boolean isExternalSchema
private String currentPackage
private String currentXmlFile
private String defaultPackage
private static SAXParserFactory saxFactory
private Vector alreadyReadFiles
private Stack parsingStack
Constructor Detail |
---|
public XmlToAppData(String databaseType)
databaseType
- The type of database for the application.public XmlToAppData(String databaseType, String defaultPackage)
databaseType
- The type of database for the application.defaultPackage
- the default java package used for the omMethod Detail |
---|
public Database parseResource(String xmlFile) throws EngineException
parseResource
in interface DatabaseParser
xmlFile
- The input file to parse.
xmlFile
.
EngineException
public InputSource resolveEntity(String publicId, String systemId) throws SAXException
resolveEntity
in interface EntityResolver
resolveEntity
in class DefaultHandler
publicId
- The public identifier of the external entitysystemId
- The system identifier of the external entity
SAXException
DTDResolver.resolveEntity(String, String)
public void startElement(String uri, String localName, String rawName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
uri
- localName
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.rawName
- The qualified name (with prefix), or the empty string if
qualified names are not available.attributes
- The specified or defaulted attributes
SAXException
public void endElement(String uri, String localName, String rawName) throws SAXException
endElement
in interface ContentHandler
endElement
in class DefaultHandler
uri
- localName
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.rawName
- The qualified name (with prefix), or the empty string if
qualified names are not available.
SAXException
public void setOption(Attributes attributes)
public void error(SAXParseException e) throws SAXException
error
in interface ErrorHandler
error
in class DefaultHandler
e
- the exception which occured while parsing
SAXException
- always
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |