Function: rng-parse-schema-locating-file
rng-parse-schema-locating-file is a byte-compiled function defined in
rng-loc.el.gz.
Signature
(rng-parse-schema-locating-file FILE)
Documentation
Return list of rules.
Each rule has the form (TYPE (ATTR . VAL) ...), where TYPE is a symbol for the element name, ATTR is a symbol for the attribute and VAL is a string for the value. Attribute values representing URIs are made absolute and xml:base attributes are removed.
Source Code
;; Defined in /usr/src/emacs/lisp/nxml/rng-loc.el.gz
(defun rng-parse-schema-locating-file (file)
"Return list of rules.
Each rule has the form (TYPE (ATTR . VAL) ...), where
TYPE is a symbol for the element name, ATTR is a symbol for the attribute
and VAL is a string for the value.
Attribute values representing URIs are made absolute and xml:base
attributes are removed."
(when (and (not rng-schema-locating-file-schema)
rng-schema-locating-file-schema-file)
(setq rng-schema-locating-file-schema
(rng-load-schema rng-schema-locating-file-schema-file)))
(let* ((element
(if rng-schema-locating-file-schema
(rng-parse-validate-file rng-schema-locating-file-schema
file)
(nxml-parse-file file)))
(children (cddr element))
(base-uri (rng-file-name-uri file))
child name rules atts att props prop-name prop-value)
(when (equal (car element)
(cons rng-locate-namespace-uri "locatingRules"))
(while children
(setq child (car children))
(setq children (cdr children))
(when (consp child)
(setq name (car child))
(when (eq (car name) rng-locate-namespace-uri)
(setq atts (cadr child))
(setq props nil)
(while atts
(setq att (car atts))
(when (stringp (car att))
(setq prop-name (intern (car att)))
(setq prop-value (cdr att))
(when (memq prop-name '(uri rules resource))
(setq prop-value
(rng-uri-resolve prop-value base-uri)))
(setq props (cons (cons prop-name prop-value)
props)))
(setq atts (cdr atts)))
(setq rules
(cons (cons (intern (cdr name)) (nreverse props))
rules))))))
(nreverse rules)))