Adrian Aichner <aichner(a)ecf.teradyne.com> wrote:
[speaking of retrieving the DTD declaration from a document:]
Here's what I came up with[1]:
(format
"<!DOCTYPE HTML PUBLIC \"%s\">\n"
(sgml-entity-text
(sgml-lookup-entity
"HTML.Version"
(sgml-dtd-parameters sgml-dtd-info))))
I'm afraid this would not work from XML DTDs. Given the above, do you
have a suggestion to make this work both for HTML and XML?
Oh, now I see what you are trying to do. Well, since the information
you want doesn't appear to be stored anywhere, how about parsing it out
of the buffer again? Something like this should do the trick:
(save-excursion
(goto-char (point-min))
(sgml-with-parser-syntax
(let (start)
(sgml-skip-upto "MDO")
(setq start (point))
(sgml-skip-upto-mdc)
(forward-char 1)
(buffer-substring start (point)))))
Does XEmacs PSGML package 1.18 come with full XML support? I
can't
seem to find a full XML DTD in it? How would one use it to create XML
documents?
It has some XML support. The XHTML 1.0 DTD is included in the package.
You could try using that to get a feel for it.
[The next part deals with using (sgml-next-trouble-spot) to get a list
of problems in a document.]
I would like to generate an error message parsable by
compilation-mode
to jump to those errors via next-error.
Have you considered using (sgml-validate (sgml-default-validate-command))
to invoke a real SGML validator (say nsgmls)? That would put all the
error messages in a buffer, ready for parsing by compilation-mode. It
also would eliminate the false positives that sgml-next-trouble-spot
tends to generate in some situations. (PSGML isn't a full SGML parser,
although it does a pretty good job.) I think that would be a lot
easier.
On the other hand, nsgmls doesn't have DTDDECL support, so it generates
lots of bogus messages, too. You'd have to throw away or ignore every
message containing the string DTDDECL. Or fix nsgmls. :-)
--
Jerry James
Email: james(a)eecs.ukans.edu
WWW:
http://www.eecs.ukans.edu/~james/