David Sewell - 2004-05-03

There is a minor bug or nuisance that occurs when using "xml val" in a case where a DTD defines entities. Consider:

test.dtd

<!ELEMENT doc (line+)>
<!ELEMENT line (#PCDATA)>
<!ENTITY nbsp  "&#x00A0;" >

test.xml

<?xml version="1.0"?>
<!DOCTYPE doc SYSTEM "test.dtd">
<doc>
        <line>This is line&nbsp;1.</line>
</doc>

Running "xml val test.xml" gives output:

test.xml:4: parser error : Entity 'nbsp' not defined
        <line>This is line&nbsp;1.</line>
                                ^
test.xml - valid
=====

Running "xml val --dtd test.dtd test.xml" gives the exact same output. However, when validating against the DTD "xml val" should read the entity definitions from the DTD before parsing the file (I think).

If you try the same files with xmllint, you will see that "xmllint --noout test.xml" produces the parsing error, but "xmllint --noout --valid test.xml" is silent, the expected behavior.