marcphilipp / dbunit-datasetbuilder

DataSetBuilder allows to dynamically create a DBUnit IDataSet from Java code
GNU Lesser General Public License v3.0
33 stars 10 forks source link

Enable option for traditional XML formatting #8

Closed javatlacati closed 7 years ago

javatlacati commented 7 years ago

XMLDataSetWritter now generates:

<?xml version='1.0' encoding='UTF-8'?>
<dataset>
  <table name="programa_institucional">
    <column>id_programa_institucional</column>
    <column>clave</column>
    <column>nombre</column>
    <column>descripcion</column>
    <row>
      <value>0</value>
      <value>p00001</value>
      <value><![CDATA[Programa institucional 1]]></value>
      <value><![CDATA[Programad e ejemplo 1]]></value>
    </row>
    <row>
      <value>1</value>
      <value>p00002</value>
      <value><![CDATA[Programa institucional 2]]></value>
      <value><![CDATA[Programad e ejemplo 2]]></value>
    </row>
  </table>
</dataset>

Instead of:

<?xml version='1.0' encoding='UTF-8'?>
<dataset>
  <programa_institucional id_programa_institucional="0"
                          clave="p00001"
                          nombre="Programa institucional 1"
                          descripcion="Programad e ejemplo 1" />

  <programa_institucional id_programa_institucional="1"
                          clave="p00002"
                          nombre="Programa institucional 2"
                          descripcion="Programad e ejemplo 2" />
</dataset>

In my case I got org.dbunit.dataset.NoSuchTableException: value with the new format and all works with the older so I had to do the xml by hand.

Is there a chance to include the old XMLDataSetWritter (Or perhaps something like this) with a write to file function so we can have the results as in the readme?

marcphilipp commented 7 years ago

This dbUnit extension does not write any XML, it just produces an IDataSet instance which can be written to XML using core dbUnit code. Please ask for help on the official dbUnit project.