Function: rng-locate-schema-file-from-type-id

rng-locate-schema-file-from-type-id is a byte-compiled function defined in rng-loc.el.gz.

Signature

(rng-locate-schema-file-from-type-id TYPE-ID FILE)

Documentation

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, or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/nxml/rng-loc.el.gz
(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,
or nil."
  (let ((rules (rng-get-parsed-schema-locating-file file))
	schema rule)
    (while (and rules (not schema))
      (setq rule (car rules))
      (setq rules (cdr rules))
      (cond ((and (eq (car rule) 'typeId)
		  (let ((id (assq 'id (cdr rule))))
		    (and id
			 (string= (rng-collapse-space (cdr id)) type-id))))
	     (setq schema (rng-match-default-rule (cdr rule))))
	    ((eq (car rule) 'include)
	     (let ((uri (cdr (assq 'rules (cdr rule)))))
	       (when uri
		 (setq schema
		       (rng-locate-schema-file-from-type-id
			type-id
			(rng-uri-file-name uri))))))))
    schema))