|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.unitils.dbunit.util.MultiSchemaXmlDataSetReader
public class MultiSchemaXmlDataSetReader
A reader for DbUnit xml datasets that creates a new ITable instance for each element (row).
Following format is expected:
<dataset>
<first_table myColumn1="value1" myColumn2="value2" />
<second_table myColumnA="A" />
<first_table myColumn2="other value2" />
<empty_table />
</dataset>
Elements for a table may occur more than once and anywhere in the data set. If multiple elements
exist, they may specify different attributes (columns). Missing attributes (columns) will be treated as null values.
Namespaces can be used to specify tables from different database schemas. The namespace URI should contain the name
of the database schema:
<dataset xmlns="SCHEMA_A" xmlns:b="SCHEMA_B">
<first_table myColumn1="value1" myColumn2="value2" />
<b:second_table myColumnA="A" />
<first_table myColumn2="other value2" />
<empty_table />
</dataset>
This example defines 2 schemas: SCHEMA_A and SCHEMA_B. The first schema is set as default schema (=default namespace).
The 'first_table' table has no namespce and is therefore linked to SCHEMA_A. The 'second_table' table is prefixed
with namespace b which is linked to SCHEMA_B. If no default namespace is defined, the schema that is
passed as constructor argument is taken as default schema.
Nested Class Summary | |
---|---|
protected static class |
MultiSchemaXmlDataSetReader.DataSetContentHandler
The xml content handler that is going to create the data sets. |
Constructor Summary | |
---|---|
MultiSchemaXmlDataSetReader(String defaultSchemaName)
Creates a data set reader. |
Method Summary | |
---|---|
protected XMLReader |
createXMLReader()
Factory method for creating the SAX xml reader. |
protected void |
disableValidation(SAXParserFactory saxParserFactory)
Disables validation on the given sax parser factory. |
MultiSchemaDataSet |
readDataSetXml(File... dataSetFiles)
Parses the datasets from the given files. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultiSchemaXmlDataSetReader(String defaultSchemaName)
defaultSchemaName
- The schema name to use when none is specified, not nullMethod Detail |
---|
public MultiSchemaDataSet readDataSetXml(File... dataSetFiles)
dataSetFiles
- The dataset files, not null
protected XMLReader createXMLReader()
protected void disableValidation(SAXParserFactory saxParserFactory)
saxParserFactory
- The factory, not null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |