| org.dbunit.dataset.CachedDataSet org.dbunit.dataset.xml.FlatXmlDataSet
FlatXmlDataSet | public class FlatXmlDataSet extends CachedDataSet (Code) | | Reads and writes flat XML dataset document. Each XML element corresponds to a table row.
Each XML element name corresponds to a table name. The XML attributes
correspond to table columns.
Flat XML dataset document sample:
<!DOCTYPE dataset SYSTEM "my-dataset.dtd">
<dataset>
<TEST_TABLE COL0="row 0 col 0"
COL1="row 0 col 1"
COL2="row 0 col 2"/>
<TEST_TABLE COL1="row 1 col 1"/>
<SECOND_TABLE COL0="row 0 col 0"
COL1="row 0 col 1" />
<EMPTY_TABLE/>
</dataset>
To specify null values, omit corresponding attribute.
In the above example, missing COL0 and COL2 attributes of TEST_TABLE second row represents null values.
Table metadata is deduced from the first row of each table. Beware that DbUnit may think
a table miss some columns if the first row of that table has one or more null values.
Because of that, this is highly recommended to use DTD. DbUnit will use the
columns declared in the DTD as table metadata. DbUnit only support external system URI.
The URI can be absolute or relative.
author: Manuel Laflamme version: $Revision: 554 $ since: Mar 12, 2002 |
Constructor Summary | |
public | FlatXmlDataSet(InputSource source) Creates an FlatXmlDataSet object with the specifed InputSource. | public | FlatXmlDataSet(File xmlFile) Creates an FlatXmlDataSet object with the specifed xml file. | public | FlatXmlDataSet(File xmlFile, boolean dtdMetadata) Creates an FlatXmlDataSet object with the specifed xml file. | public | FlatXmlDataSet(URL xmlUrl) Creates an FlatXmlDataSet object with the specifed xml URL. | public | FlatXmlDataSet(URL xmlUrl, boolean dtdMetadata) Creates an FlatXmlDataSet object with the specifed xml URL. | public | FlatXmlDataSet(Reader xmlReader) Creates an FlatXmlDataSet object with the specifed xml reader. | public | FlatXmlDataSet(Reader xmlReader, boolean dtdMetadata) Creates an FlatXmlDataSet object with the specifed xml reader. | public | FlatXmlDataSet(Reader xmlReader, Reader dtdReader) Creates an FlatXmlDataSet object with the specifed xml and dtd readers. | public | FlatXmlDataSet(Reader xmlReader, IDataSet metaDataSet) Creates an FlatXmlDataSet object with the specifed xml reader. | public | FlatXmlDataSet(InputStream xmlStream) Creates an FlatXmlDataSet object with the specifed xml input stream. | public | FlatXmlDataSet(InputStream xmlStream, boolean dtdMetadata) Creates an FlatXmlDataSet object with the specifed xml input stream. | public | FlatXmlDataSet(InputStream xmlStream, InputStream dtdStream) Creates an FlatXmlDataSet object with the specifed xml and dtd input
stream. | public | FlatXmlDataSet(InputStream xmlStream, IDataSet metaDataSet) Creates an FlatXmlDataSet object with the specifed xml input stream. |
Method Summary | |
public static void | write(IDataSet dataSet, OutputStream out) Write the specified dataset to the specified output stream as xml. | public static void | write(IDataSet dataSet, Writer writer) Write the specified dataset to the specified writer as xml. | public static void | write(IDataSet dataSet, Writer writer, String encoding) Write the specified dataset to the specified writer as xml. | public static void | writeDtd(IDataSet dataSet, OutputStream out) Write a DTD for the specified dataset to the specified output. |
FlatXmlDataSet | public FlatXmlDataSet(File xmlFile) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml file.
Relative DOCTYPE uri are resolved from the xml file path.
Parameters: xmlFile - the xml file |
FlatXmlDataSet | public FlatXmlDataSet(File xmlFile, boolean dtdMetadata) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml file.
Relative DOCTYPE uri are resolved from the xml file path.
Parameters: xmlFile - the xml file Parameters: dtdMetadata - if false do not use DTD as metadata |
FlatXmlDataSet | public FlatXmlDataSet(URL xmlUrl) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml URL.
Relative DOCTYPE uri are resolved from the xml file path.
Parameters: xmlUrl - the xml URL |
FlatXmlDataSet | public FlatXmlDataSet(URL xmlUrl, boolean dtdMetadata) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml URL.
Relative DOCTYPE uri are resolved from the xml file path.
Parameters: xmlUrl - the xml URL Parameters: dtdMetadata - if false do not use DTD as metadata |
FlatXmlDataSet | public FlatXmlDataSet(Reader xmlReader) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml reader.
Relative DOCTYPE uri are resolved from the current working dicrectory.
Parameters: xmlReader - the xml reader |
FlatXmlDataSet | public FlatXmlDataSet(Reader xmlReader, boolean dtdMetadata) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml reader.
Relative DOCTYPE uri are resolved from the current working dicrectory.
Parameters: xmlReader - the xml reader Parameters: dtdMetadata - if false do not use DTD as metadata |
FlatXmlDataSet | public FlatXmlDataSet(Reader xmlReader, Reader dtdReader) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml and dtd readers.
Parameters: xmlReader - the xml reader Parameters: dtdReader - the dtd reader |
FlatXmlDataSet | public FlatXmlDataSet(Reader xmlReader, IDataSet metaDataSet) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml reader.
Parameters: xmlReader - the xml reader Parameters: metaDataSet - the dataset used as metadata source. |
FlatXmlDataSet | public FlatXmlDataSet(InputStream xmlStream) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml input stream.
Relative DOCTYPE uri are resolved from the current working dicrectory.
Parameters: xmlStream - the xml input stream |
FlatXmlDataSet | public FlatXmlDataSet(InputStream xmlStream, boolean dtdMetadata) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml input stream.
Relative DOCTYPE uri are resolved from the current working dicrectory.
Parameters: xmlStream - the xml input stream Parameters: dtdMetadata - if false do not use DTD as metadata |
FlatXmlDataSet | public FlatXmlDataSet(InputStream xmlStream, InputStream dtdStream) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml and dtd input
stream.
Parameters: xmlStream - the xml input stream Parameters: dtdStream - the dtd input stream |
FlatXmlDataSet | public FlatXmlDataSet(InputStream xmlStream, IDataSet metaDataSet) throws IOException, DataSetException(Code) | | Creates an FlatXmlDataSet object with the specifed xml input stream.
Parameters: xmlStream - the xml input stream Parameters: metaDataSet - the dataset used as metadata source. |
|
|