>>>> "Jerry" == Jerry James
<james(a)eecs.ukans.edu> writes:
Jerry> Adrian Aichner <aichner(a)ecf.teradyne.com> wrote:
> While implementing HTML document validation for our
next-generation
> XEmacs website I have some questions about PSGML:
>
> 1. How can I access the DTD doctype of buffer after validating it
> (i.e. it has been parsed and all information should be available
> via sgml-dtd-info)?
Jerry> If you just want the generic type (like "HTML"), then
Jerry> (sgml-dtd-doctype sgml-dtd-info) should do the trick. If
Jerry> you want the name of the file containing the DTD, use
Jerry> (sgml-declaration). If you want the public identifier of
Jerry> the DTD, then I'm afraid that you are out of luck. As far
Jerry> as I can see, that information is discarded after the
Jerry> public identifier is mapped to a file. The file name is
Jerry> probably better anyway, since multiple forms of an
Jerry> identifier can be mapped to the same file.
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?
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?
> 2. How can I access the error message reported by
> (sgml-next-trouble-spot)?
Jerry> Those messages are generated with (message ...), so
Jerry> (current-message) should get the most recent one. I think.
Jerry> But what you wrote next makes me think I misinterpreted
Jerry> your question. Did I misunderstand you?
I would like to generate an error message parsable by compilation-mode
to jump to those errors via next-error.
My current solution is to redefine sgml-log-warning:
;; APA: Encapsulate sgml-log-warning to capture batch-psgml-last-warning.
(defun batch-psgml-validate-log-warning (format &rest things)
(setq batch-psgml-last-warning (apply 'format format things))
(when sgml-throw-on-warning
(throw sgml-throw-on-warning t)))
(fset 'sgml-log-warning 'batch-psgml-validate-log-warning)
I'll give your suggestion to use (current-message) a shot.
Best regards,
Adrian
> I tried using
> (if sgml-last-element
> (setq context (sgml-element-context-string sgml-last-element)))
> but sgml-last-element is nil even though an error occured. To be
> honest, it worked in a debugging session of XEmacs, but not in a
> freshly started one.
Jerry> Regards,
Jerry> --
Jerry> Jerry James
Jerry> Email: james(a)eecs.ukans.edu
Jerry> WWW:
http://www.eecs.ukans.edu/~james/
Footnotes:
[1] See
http://xemacs.sourceforge.net/batch-psgml-validate.el for the
whole file used for XEmacs website validation.