Function: sgml-parse-dtd

sgml-parse-dtd is a byte-compiled function defined in sgml-mode.el.gz.

Signature

(sgml-parse-dtd)

Documentation

Simplistic parse of the current buffer as a DTD.

Currently just returns (EMPTY-TAGS UNCLOSED-TAGS).

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/sgml-mode.el.gz
(defun sgml-parse-dtd ()
  "Simplistic parse of the current buffer as a DTD.
Currently just returns (EMPTY-TAGS UNCLOSED-TAGS)."
  (goto-char (point-min))
  (let ((empty nil)
	(unclosed nil))
    (while (re-search-forward "<!ELEMENT[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+[-O][ \t\n]+\\([-O]\\)[ \t\n]+\\([^ \t\n]+\\)" nil t)
      (cond
       ((string= (match-string 3) "EMPTY")
	(push (match-string-no-properties 1) empty))
       ((string= (match-string 2) "O")
	(push (match-string-no-properties 1) unclosed))))
    (setq empty (sort (mapcar #'downcase empty) #'string<))
    (setq unclosed (sort (mapcar #'downcase unclosed) #'string<))
    (list empty unclosed)))