Gleb Arshinov <gleb(a)broadbase.com> wrote:
Save this to a file xhtml_test.html. Open it. Run C-c C-p
`sgml-parse-prolog'. At this point PSGML attempted to compile
xhtml1-transitional.dtd, and barfed while parsing it (i.e. while
parsing the DTD not the XHTML test document). The backtrace for this
is in my original message.
Aha! Note that you were parsing the prolog *in SGML mode*! The real
problem here is that the ".html" extension, in conjunction with
auto-mode-alist, puts you into html-mode, which is a descendant of
sgml-mode. Try this. Save your test file to xhtml_test.xhtml. Open
it. XEmacs doesn't recognize that extension, so it is in fundamental
mode. Now type M-x xml-mode. Then type C-c C-p. PSGML now tells you
"XML requires a system ID after a public ID". Hmmm, there are a few
problems with that file. Try this one instead:
------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en">
<head>
<title>My Title</title>
</head>
<body>
<h1>My Title</h1>
</body>
</html>
------------------------------------------------------------------------
Now, *in xml-mode*, type C-c C-p. No problem. Type C-c C-o (to go to
the first problem spot). It goes to the end and reports "Ok".
After much scratching my head, I figured out that lines of the form:
xml:lang language code (as per XML 1.0 spec)
in xhtml1-transitional.dtd were causing the parsing error. When I
removed these lines, PSGML was able to parse and compile the DTD. The
reason parsing of this DTD fails seems to be that PSGML uses
sgml-parser-syntax to parse the DTD and it considers ':' a terminator
for the token. So adding ':' to sgml-parser-syntax got rid of the
problem for me.
Sure, but that isn't the right solution in general. The colon should
not be in sgml-parser-syntax, since that is not good SGML. The right
solution is to avoid assuming sgml-mode when the file extension is
.html. I'm not sure how to do that, unfortunately.
--
Jerry James