Click to See Complete Forum and Search --> : multiple DOCTYPE declarations in IE


kwokwai
04-25-2007, 02:25 PM
Hi, I am learning XML and DTD.
To start with my first lesson, I wrote a test.xml and a test.dtd files which contents are as follows:

test.xml:
<?xml version="1.0"?>
<!DOCTYPE address SYSTEM "test.dtd">
<address>
<street> 170 Lygon St.</street>
<city>Melbourne</city>
<state>Victoria</state>
<zip>3000</zip>
<country>A</country>
</address>

test.dtd:
<?xml version="1.0"?>
<!DOCTYPE address [
<!ELEMENT address (street+, city, state, zip, country?)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT state (#PCDATA)>
<!ELEMENT zip (#PCDATA)>
<!ELEMENT country (#PCDATA)>
]>

But then when I loaded the page in my I.E.6, I got this error message:
multiple DOCTYPE declarations....

Any ideas how solve the problem?

Charles
04-25-2007, 02:42 PM
Your DTD isn't an XML document, it's an XML DTD. So:<!ELEMENT address (street+, city, state, zip, country?)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT state (#PCDATA)>
<!ELEMENT zip (#PCDATA)>
<!ELEMENT country (#PCDATA)>In the same way when you use external CSS or JavaScript with HTML you omit the tags in the external file. Should you find yourself stuck, see http://www.w3.org/TR/xhtml1/dtds.html for a working example.