Problem with syntax of html strict.dtd?

J

John Resler

Hi,
I am trying to track down a bug in a program I've written which
parses an XHTML document. The document has been cleaned up with Tidy and
converted to XHTML and has a strict.dtd reference. When the xerces
parser hits a line in the dtd, I get the following output:

**Parsing Fatal Error**
Line: 81
URI: http://www.w3.org/TR/REC-html40/strict.dtd
Message: The declaration for the entity "ContentType" must end with '>'.

I looked at the dtd in XMLSpy and elsewhere and it does seem to be
incorrect... can anybody help me out here?


-John
 
D

Dean Tiegs

I am trying to track down a bug in a program I've written which
parses an XHTML document. The document has been cleaned up with Tidy and
converted to XHTML and has a strict.dtd reference. When the xerces
parser hits a line in the dtd, I get the following output:

**Parsing Fatal Error**
Line: 81
URI: http://www.w3.org/TR/REC-html40/strict.dtd
Message: The declaration for the entity "ContentType" must end with '>'.

I looked at the dtd in XMLSpy and elsewhere and it does seem to be
incorrect... can anybody help me out here?

That's an HTML DTD, so it's no wonder that an XML parser cannot parse it.
Try using an XHTML DTD, such as
<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>.
 
D

Dean Tiegs

Ok, but it's still a dtd and has to conform to rules for dtd format.
Why the parse error? I thought a dtd was a dtd...? Thanks for the
help by the way.

There are SGML DTDs and then there are XML DTDs. HTML is an SGML
language, so it has an SGML DTD. XHTML is an XML language and has an XML
DTD.

XML is a subset of SGML, so an SGML parser can parse XML documents and
DTDs, but in general an XML parser cannot parse SGML documents and DTDs.

For example, in SGML it's OK to put comments inside entity declarations
(delimited with double hyphens: --this is a comment--), but in XML this is
forbidden. It is just such a comment that your XML parser is rejecting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,839
Latest member
MartinaBur

Latest Threads

Top