Search code examples
javaxmljunitdtddbunit

dbUnit dtd error: The declaration for element type "dataset" must end with '>'


I work with dbUnit for the first time. I took the sample dtd from here:

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT dataset (table+) | ANY>
<!ELEMENT table (column*, row*)>
<!ATTLIST table
    name CDATA #REQUIRED
>
<!ELEMENT column (#PCDATA)>
<!ELEMENT row (value | null | none)*>
<!ELEMENT value (#PCDATA)>
<!ELEMENT null EMPTY>

I get the following error:

org.dbunit.dataset.DataSetException: Line 2: The declaration for element type "dataset" must end with '>'.

What does that mean? I'm confused because I took the original dtd and secondly there is a '>' at the end of the dataset definition.

Thank you for your help!


Solution

  • Changing the first line to:

    <!ELEMENT dataset (table+ | ANY)>

    will make the syntax correct.

    However, the model may just as well be:

    <!ELEMENT dataset ANY>

    as the "ANY" context specification will match table elements anyway (and more, see: http://www.w3.org/TR/xml/#sec-logical-struct)