Re: Starting nxml-mode with specified schema

"Lennart Borgman (gmail)" <[email protected]>
Newsgroups gmane.emacs.nxml.general
Message-ID <[email protected]>
Lennart Borgman (gmail) wrote:
> 
> 
> I would like to be able to start nxml-mode with a specified schema if
> there is none specified in the file. (I do not want to save the schema
> location since this should be for any file.)
> 
> Is there a way to do this? If not, what would be the best way to
> implement it?


I am using something like this at the moment. Advice for better 
implementation is very welcome!

(define-derived-mode nxhtml-genshi-mode nxhtml-mode "gXhtml"
   "Like `nxhtml-mode' but with genshi rnc."
   (when (or (not rng-current-schema-file-name)
             (string= "xhtml.rnc" (file-name-nondirectory 
rng-current-schema-file-name)))
     ;; Fix-me: locate with a hack right now:
     (let* ((dir (file-name-directory (nth 1 rng-schema-locating-files)))
            (genshi-rnc (expand-file-name "qtmstr-xhtml.rnc" dir)))
       (condition-case err
           (progn
             (rng-set-schema-file-1 genshi-rnc)
             (rng-what-schema)
             ;;(rng-save-schema-location-1 t)
             )
         (nxml-file-parse-error
          (nxml-display-file-parse-error err)))
       (when rng-validate-mode
         (rng-validate-mode 0)
         (rng-validate-mode 1)))))


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/emacs-nxml-mode/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/emacs-nxml-mode/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.