Package org.dbunit.dataset.xml
Class XmlDataSet
java.lang.Object
org.dbunit.dataset.AbstractDataSet
org.dbunit.dataset.CachedDataSet
org.dbunit.dataset.xml.XmlDataSet
- All Implemented Interfaces:
IDataSet,IDataSetConsumer
Reads and writes original XML dataset document. This format
is very verbose and must conform to the following DTD:
<?xml version="1.0" encoding="UTF-8"?> <!ELEMENT dataset (table+)> <!ELEMENT table (column*, row*)> <!ATTLIST table name CDATA #REQUIRED> <!ELEMENT column (#PCDATA)> <!ELEMENT row (value | null | none)*> <!ELEMENT value (#PCDATA)> <!ELEMENT null EMPTY> <!ELEMENT none EMPTY>
- Since:
- 1.0 (Feb 17, 2002)
- Version:
- $Revision$ $Date$
- Author:
- Manuel Laflamme, Last changed by: $Author$
-
Field Summary
Fields inherited from class org.dbunit.dataset.AbstractDataSet
_orderedTableNameMap -
Constructor Summary
ConstructorsConstructorDescriptionCreates an XmlDataSet with the specified xml input stream.XmlDataSet(Reader reader) Creates an XmlDataSet with the specified xml reader. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidwrite(IDataSet dataSet, OutputStream out) Write the specified dataset to the specified output stream as xml.static voidwrite(IDataSet dataSet, OutputStream out, Charset charset) Write the specified dataset to the specified output stream as xml (using specified encoding).static voidWrite the specified dataset to the specified writer as xml.static voidWrite the specified dataset to the specified writer as xml.Methods inherited from class org.dbunit.dataset.CachedDataSet
createIterator, endDataSet, endTable, row, startDataSet, startTableMethods inherited from class org.dbunit.dataset.AbstractDataSet
createTableNameMap, getTable, getTableMetaData, getTableNames, getTables, initialize, isCaseSensitiveTableNames, iterator, reverseIterator, toString
-
Constructor Details
-
XmlDataSet
Creates an XmlDataSet with the specified xml reader.- Parameters:
reader- the reader to load the xml document from.- Throws:
DataSetException- if the document cannot be parsed.
-
XmlDataSet
Creates an XmlDataSet with the specified xml input stream.- Parameters:
in- the stream to load the xml document from.- Throws:
DataSetException- if the document cannot be parsed.
-
-
Method Details
-
write
Write the specified dataset to the specified output stream as xml.- Parameters:
dataSet- the dataset to write.out- the stream to write the xml document to.- Throws:
IOException- if writing to the stream fails.DataSetException- if the dataset cannot be read.
-
write
public static void write(IDataSet dataSet, OutputStream out, Charset charset) throws IOException, DataSetException Write the specified dataset to the specified output stream as xml (using specified encoding).- Parameters:
dataSet- the dataset to write.out- the stream to write the xml document to.charset- the character encoding to write the document in.- Throws:
IOException- if writing to the stream fails.DataSetException- if the dataset cannot be read.
-
write
Write the specified dataset to the specified writer as xml.- Parameters:
dataSet- the dataset to write.writer- the writer to write the xml document to.- Throws:
IOException- if writing to the writer fails.DataSetException- if the dataset cannot be read.
-
write
public static void write(IDataSet dataSet, Writer writer, Charset charset) throws IOException, DataSetException Write the specified dataset to the specified writer as xml.- Parameters:
dataSet- the dataset to write.writer- the writer to write the xml document to.charset- the character encoding to write the document in.- Throws:
IOException- if writing to the writer fails.DataSetException- if the dataset cannot be read.
-