public class MultiSchemaXmlDataSetReader extends Object
<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.| Modifier and Type | Class and Description |
|---|---|
protected static class |
MultiSchemaXmlDataSetReader.DataSetContentHandler
The xml content handler that is going to create the data sets.
|
| Constructor and Description |
|---|
MultiSchemaXmlDataSetReader(String defaultSchemaName)
Creates a data set reader.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public MultiSchemaXmlDataSetReader(String defaultSchemaName)
defaultSchemaName - The schema name to use when none is specified, not nullpublic MultiSchemaDataSet readDataSetXml(File... dataSetFiles)
dataSetFiles - The dataset files, not nullprotected XMLReader createXMLReader()
protected void disableValidation(SAXParserFactory saxParserFactory)
saxParserFactory - The factory, not nullCopyright © 2017. All rights reserved.