Package org.dbunit.dataset.xml
Class XmlDataSetWriter
java.lang.Object
org.dbunit.dataset.xml.XmlDataSetWriter
- All Implemented Interfaces:
IDataSetConsumer
- Since:
- 1.5.5 (Jun 13, 2003)
- Version:
- $Revision$ $Date$
- Author:
- Manuel Laflamme, Last changed by: $Author$
-
Constructor Summary
ConstructorsConstructorDescriptionXmlDataSetWriter(OutputStream outputStream, Charset charset) XmlDataSetWriter(Writer writer) XmlDataSetWriter(Writer writer, Charset charset) -
Method Summary
Modifier and TypeMethodDescriptionvoidReceive notification of the end of a dataset.voidendTable()Receive notification of the end of a table.protected final XmlWritervoidReceive notification of a table row.voidsetIncludeColumnComments(boolean includeColumnComments) Whether or not to write the column name as comment into the XMLvoidsetPrettyPrint(boolean enabled) Enable or disable pretty print of the XML.voidReceive notification of the beginning of a dataset.voidstartTable(ITableMetaData metaData) Receive notification of the beginning of a table.voidWrites the givenIDataSetusing this writer.protected voidwriteValue(String stringValue) Writes the given String as normal text using theXmlWriter.protected voidwriteValueCData(String stringValue) Writes the given String as CDATA using theXmlWriter.
-
Constructor Details
-
XmlDataSetWriter
- Parameters:
outputStream- The stream to which the XML will be written.encoding- The encoding to be used for theXmlWriter. Can be null. See.invalid reference
XmlWriter#XmlWriter(OutputStream, String)- Throws:
UnsupportedEncodingException
-
XmlDataSetWriter
-
XmlDataSetWriter
-
-
Method Details
-
setPrettyPrint
public void setPrettyPrint(boolean enabled) Enable or disable pretty print of the XML.- Parameters:
enabled-trueto enable pretty print (which is the default).falseotherwise.- Since:
- 2.4
-
setIncludeColumnComments
public void setIncludeColumnComments(boolean includeColumnComments) Whether or not to write the column name as comment into the XML- Parameters:
includeColumnComments- Whether or not to write the column name as comment into the XML
-
write
Writes the givenIDataSetusing this writer.- Parameters:
dataSet- TheIDataSetto be written- Throws:
DataSetException
-
startDataSet
Description copied from interface:IDataSetConsumerReceive notification of the beginning of a dataset. This method is invoked only once, before any other methods in this interface.- Specified by:
startDataSetin interfaceIDataSetConsumer- Throws:
DataSetException
-
endDataSet
Description copied from interface:IDataSetConsumerReceive notification of the end of a dataset. This method is invoked only once, and it will be the last method invoked in this interface.- Specified by:
endDataSetin interfaceIDataSetConsumer- Throws:
DataSetException
-
startTable
Description copied from interface:IDataSetConsumerReceive notification of the beginning of a table. This method is invoked at the beginning of every table in the dataset; there will be a correspondingIDataSetConsumer.endDataSet()event for everystartTableevent (even when the table is empty).- Specified by:
startTablein interfaceIDataSetConsumer- Parameters:
metaData- the table metadata- Throws:
DataSetException
-
endTable
Description copied from interface:IDataSetConsumerReceive notification of the end of a table.- Specified by:
endTablein interfaceIDataSetConsumer- Throws:
DataSetException
-
row
Description copied from interface:IDataSetConsumerReceive notification of a table row. This method is invoked to report each row of a table.- Specified by:
rowin interfaceIDataSetConsumer- Parameters:
values- The row values.- Throws:
DataSetException
-
writeValueCData
Writes the given String as CDATA using theXmlWriter. Can be overridden to add custom behavior. This implementation just invokesXmlWriter.writeCData(String)- Parameters:
stringValue- The value to be written- Throws:
IOException- Since:
- 2.4.4
-
writeValue
Writes the given String as normal text using theXmlWriter. Can be overridden to add custom behavior. This implementation just invokesXmlWriter.writeText(String).- Parameters:
stringValue- The value to be written- Throws:
IOException- Since:
- 2.4.4
-
getXmlWriter
- Returns:
- The
XmlWriterthat is used for writing out XML. - Since:
- 2.4.4
-