Hi,
I have just started working with DTDs and I feel I am getting strange results
from validation. Since I am not an XML expert, I hope someone can help.
I will use a minimal example:
given the following 'test.dtd':
<?xml encoding="UTF-8"?>
<!ELEMENT container (content)>
<!ELEMENT content (name)>
<!ELEMENT name (#PCDATA)>
and the following 'test.xml':
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE container SYSTEM "test.dtd">
<container>
<name>Cat</name>
<content>
<name>Dog</name>
</content>
</container>
I would expect, from what I have understood about DTDs (which could not be
enough, I admit) that a validating parser should raise an exception indicating
the presence of a <name> element outside of a <content> element. Instead Xerces
parses such a file without problems.
I have tried inserting unknown tags and they are correctly refused, so I
believe the parser is using the right DTD file. Besides, if the DTD file is not
where it should be, the parser complains.
I am using Xerces 1.4.2 and SAX2. All error handling is perfectly functional
(I've done a number of tests), it's just that the parser seem to find this
construct correct.
Am I wrong to believe that my example should be considered invalid?
Thanks in advance for any help.
Amedeo
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]