;;; rng-loc.el --- locate the schema to use for validation
-;; Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2015 Free Software Foundation, Inc.
;; Author: James Clark
-;; Keywords: XML, RelaxNG
+;; Keywords: wp, hypermedia, languages, XML, RelaxNG
;; This file is part of GNU Emacs.
(defvar rng-current-schema-file-name nil
"Filename of schema being used for current buffer.
-Nil if using a vacuous schema.")
+It is nil if using a vacuous schema.")
(make-variable-buffer-local 'rng-current-schema-file-name)
(defvar rng-schema-locating-files-default
"Schema for schema locating files or nil if not yet loaded.")
(defcustom rng-schema-locating-files rng-schema-locating-files-default
- "*List of schema locating files."
+ "List of schema locating files."
:type '(repeat file)
:group 'relax-ng)
FILENAME must be the name of a file containing a schema.
The extension of FILENAME is used to determine what kind of schema it
is. The variable `rng-schema-loader-alist' maps from schema
-extensions to schema loader functions. The function
+extensions to schema loader functions. The function
`rng-c-load-schema' is the loader for RELAX NG compact syntax. The
association is between the buffer and the schema: the association is
lost when the buffer is killed."
rng-any-element))
(setq rng-current-schema-file-name filename)
(run-hooks 'rng-schema-change-hook))
-
+
(defun rng-load-schema (filename)
(let* ((extension (file-name-extension filename))
(loader (cdr (assoc extension rng-schema-loader-alist))))
"Display a message saying what schema `rng-validate-mode' is using."
(interactive)
(if rng-current-schema-file-name
- (message "Using schema %s"
+ (message "Using schema %s"
(abbreviate-file-name rng-current-schema-file-name))
(message "Using vacuous schema")))
(defun rng-locate-schema-file-using (files)
"Locate a schema using the schema locating files FILES.
FILES is a list of file-names.
-Return either a URI, a list (TYPE-ID) where TYPE-ID is a string
+Return either a URI, a list (TYPE-ID) where TYPE-ID is a string,
or nil."
(let (rules
;; List of types that override normal order-based
(defun rng-locate-schema-file-from-type-id (type-id file)
"Locate the schema for type id TYPE-ID using schema locating file FILE.
-Return either a URI, a list (TYPE-ID) where TYPE-ID is a string
+Return either a URI, a list (TYPE-ID) where TYPE-ID is a string,
or nil."
(let ((rules (rng-get-parsed-schema-locating-file file))
schema rule)
(cons (list file mtime parsed)
rng-schema-locating-file-alist)))
parsed))))
-
+
(defconst rng-locate-namespace-uri
(nxml-make-namespace "http://thaiopensource.com/ns/locating-rules/1.0"))
"schema location")
file)))))
(t
- (save-excursion
- (set-buffer (find-file-noselect file))
+ (with-current-buffer (find-file-noselect file)
(let ((modified (buffer-modified-p)))
(if (> (buffer-size) 0)
(let (xmltok-dtd)
(provide 'rng-loc)
-;; arch-tag: 725cf968-37a2-418b-b47b-d5209871a9ab
;;; rng-loc.el ends here