Function: rng-parse-validate-file

rng-parse-validate-file is a byte-compiled function defined in rng-parse.el.gz.

Signature

(rng-parse-validate-file SCHEMA FILE)

Documentation

Parse and validate the XML document in FILE and return it as a list.

The returned list has the same form as that returned by nxml-parse-file. SCHEMA is a list representing the schema to use for validation, such as returned by the function rng-c-load-schema. If the XML document is invalid with respect to schema, an error will be signaled in the same way as when it is not well-formed.

Source Code

;; Defined in /usr/src/emacs/lisp/nxml/rng-parse.el.gz
(defun rng-parse-validate-file (schema file)
  "Parse and validate the XML document in FILE and return it as a list.
The returned list has the same form as that returned by
`nxml-parse-file'.  SCHEMA is a list representing the schema to use
for validation, such as returned by the function `rng-c-load-schema'.
If the XML document is invalid with respect to schema, an error will
be signaled in the same way as when it is not well-formed."
  (with-current-buffer (nxml-parse-find-file file)
    (unwind-protect
	(let ((nxml-parse-file-name file)
	      (nxml-validate-function 'rng-parse-do-validate)
	      (rng-dt-namespace-context-getter '(nxml-ns-get-context))
	      rng-parse-prev-was-start-tag)
	  ;; We don't simply call nxml-parse-file, because
	  ;; we want to do rng-match-with-schema in the same
	  ;; buffer in which we will call the other rng-match-* functions.
	  (rng-match-with-schema schema
	    (nxml-parse-instance)))
      (kill-buffer nil))))