>>>> "Jerry" == Jerry James
<james(a)eecs.ukans.edu> writes:
Jerry> Adrian Aichner <aichner(a)ecf.teradyne.com> wrote:
Jerry> [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?
Jerry> Oh, now I see what you are trying to do. Well, since the
Jerry> information you want doesn't appear to be stored anywhere,
Jerry> how about parsing it out of the buffer again? Something
Jerry> like this should do the trick:
Jerry> (save-excursion
Jerry> (goto-char (point-min))
Jerry> (sgml-with-parser-syntax
Jerry> (let (start)
Jerry> (sgml-skip-upto "MDO")
Jerry> (setq start (point))
Jerry> (sgml-skip-upto-mdc)
Jerry> (forward-char 1)
Jerry> (buffer-substring start (point)))))
Thanks Jerry. batch-psgml-validate.el uses the above now.
> 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?
Jerry> It has some XML support. The XHTML 1.0 DTD is included in
Jerry> the package. You could try using that to get a feel for
Jerry> it.
Look good. I have to manually switch to xml-mode though, to get the
DTD parsed. Is this right?
Will XML documents eventually use a .xml extension?
Jerry> [The next part deals with using (sgml-next-trouble-spot) to
Jerry> 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.
Jerry> Have you considered using (sgml-validate
Jerry> (sgml-default-validate-command)) to invoke a real SGML
Jerry> validator (say nsgmls)? That would put all the error
I stopped using external validation programs ever since I found PSGML.
Jerry> messages in a buffer, ready for parsing by
Jerry> compilation-mode. It also would eliminate the false
Jerry> positives that sgml-next-trouble-spot tends to generate in
Jerry> some situations. (PSGML isn't a full SGML parser, although
Jerry> it does a pretty good job.) I think that would be a lot
I have yet to find an instance where PSGML screws up.
Jerry> easier.
Jerry> On the other hand, nsgmls doesn't have DTDDECL support, so
Jerry> it generates lots of bogus messages, too. You'd have to
I won't use it then.
Jerry> throw away or ignore every message containing the string
Jerry> DTDDECL. Or fix nsgmls. :-) -- Jerry James Email:
Got enough on my hands already :-)
Jerry> james(a)eecs.ukans.edu WWW:
http://www.eecs.ukans.edu/~james/
Thanks for your help!
Best regards,
Adrian
--
Adrian Aichner <adrian(a)xemacs.org>