Example:
- Code: Select all
<dataset>
<table name="table1">
<column>A</column>
<column>B</column>
<row>
<null/>
<value>abc</value>
</row>
<row>
<value>2</value>
<value>def</value>
</row>
</table>
</dataset>
If column 'A' is a numeric type for example, we would get a NumberFormatException. (<null/> is ignored, so 'abc' is taken as the value for column 'A'.
Simple patch to solve this issue:
Index: src/main/java/org/databene/platform/dbunit/DbUnitEntityIterator.java
===================================================================
--- src/main/java/org/databene/platform/dbunit/DbUnitEntityIterator.java (revision 5117)
+++ src/main/java/org/databene/platform/dbunit/DbUnitEntityIterator.java (working copy)
@@ -157,7 +157,7 @@
NodeList rows = tableNode.getElementsByTagName("row");
for (int rownum = 0; rownum < rows.getLength(); rownum++) {
Element row = (Element) rows.item(rownum);
- NodeList cellNodes = row.getElementsByTagName("value");
+ NodeList cellNodes = row.getElementsByTagName("*");
String[] values = new String[cellNodes.getLength()];
for (int cellnum = 0; cellnum < cellNodes.getLength(); cellnum++) {
Element cell = (Element) cellNodes.item(cellnum);
BTW: why not using the DBUnit Dataset abstraction (for mass data maybe a streaming implementation)?
