org.unitils.dbunit.util
Class MultiSchemaXmlDataSetReader.DataSetContentHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.unitils.dbunit.util.MultiSchemaXmlDataSetReader.DataSetContentHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Enclosing class:
MultiSchemaXmlDataSetReader

protected static class MultiSchemaXmlDataSetReader.DataSetContentHandler
extends DefaultHandler

The xml content handler that is going to create the data sets.


Field Summary
protected  Map<String,DbUnitDataSet> dbUnitDataSetsPerSchemaName
           
protected  String defaultSchemaName
           
 
Constructor Summary
MultiSchemaXmlDataSetReader.DataSetContentHandler(String defaultSchemaName)
          Creates a data set SAX content handler
 
Method Summary
protected  void addRow(Attributes attributes, DbUnitTable table)
          Gets column names and row values from the given attribute and adds a new row to the given table.
 void error(SAXParseException e)
          Overridden to rethrow exception.
 MultiSchemaDataSet getMultiSchemaDataSet()
          Gets the result data set.
 void startElement(String uri, String localName, String qName, Attributes attributes)
          Processes an xml element.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, 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

defaultSchemaName

protected String defaultSchemaName

dbUnitDataSetsPerSchemaName

protected Map<String,DbUnitDataSet> dbUnitDataSetsPerSchemaName
Constructor Detail

MultiSchemaXmlDataSetReader.DataSetContentHandler

public MultiSchemaXmlDataSetReader.DataSetContentHandler(String defaultSchemaName)
Creates a data set SAX content handler

Parameters:
defaultSchemaName - The schema name to use when none is specified, not null
Method Detail

getMultiSchemaDataSet

public MultiSchemaDataSet getMultiSchemaDataSet()
Gets the result data set.

Returns:
the data set, not null

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Processes an xml element. A new table is started for each element.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Parameters:
uri - the xml namespace uri (= schema name)
localName - the local xml name
qName - the element name (should be table name for table rows)
attributes - the attributes (should be table columns for table rows)
Throws:
SAXException

addRow

protected void addRow(Attributes attributes,
                      DbUnitTable table)
Gets column names and row values from the given attribute and adds a new row to the given table.

Parameters:
table - The table to add the row to, not null
attributes - the attributes, not null

error

public void error(SAXParseException e)
           throws SAXException
Overridden to rethrow exception.

Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Parameters:
e - The exception
Throws:
SAXException


Copyright © 2014. All Rights Reserved.