Inasmuch as the <?xml-model?>
processing instruction (jointly developed by W3C and ISO/IEC JTC1/SC34) is the new, standard way to associate schemas with XML documents and I already had code for using a similar, oXygen-specific PI, it was easy to make a hook function to put in your .emacs file so nXML mode will use <?xml-model?>
to find a RNC schema:
(defun use-xml-model () "Hook function for `nxml-mode' to use PI for locating a RNC schema." (interactive) (save-excursion (goto-char (point-min)) (if (search-forward "" nil t) (match-beginning 0))) (filename (save-excursion (re-search-forward "href=\"\\([^\"]+\.rnc\\)\"" pi-end t) (match-string 1)))) ;; (message "pi-end: %d; filename: %s ;; pi-end filename) (if (and filename (file-readable-p filename)) (rng-set-schema-file filename))))))) (add-hook 'nxml-mode-hook 'use-xml-model)