Function: rng-do-some-validation-1
rng-do-some-validation-1 is a byte-compiled function defined in
rng-valid.el.gz.
Signature
(rng-do-some-validation-1 &optional CONTINUE-P-FUNCTION)
Source Code
;; Defined in /usr/src/emacs/lisp/nxml/rng-valid.el.gz
(defun rng-do-some-validation-1 (&optional continue-p-function)
(let ((limit (+ rng-validate-up-to-date-end
rng-validate-chunk-size))
(remove-start rng-validate-up-to-date-end)
(next-cache-point (+ (point) rng-state-cache-distance))
(continue t)
(xmltok-dtd rng-dtd)
have-remaining-chars
xmltok-type
xmltok-start
xmltok-name-colon
xmltok-name-end
xmltok-replacement
xmltok-attributes
xmltok-namespace-attributes
xmltok-errors)
(when (= (point) 1)
(let ((regions (xmltok-forward-prolog)))
(rng-clear-overlays 1 (point))
(while regions
(when (eq (aref (car regions) 0) 'encoding-name)
(rng-process-encoding-name (aref (car regions) 1)
(aref (car regions) 2)))
(setq regions (cdr regions))))
(unless (equal rng-dtd xmltok-dtd)
(rng-clear-conditional-region))
(setq rng-dtd xmltok-dtd))
(while continue
(setq have-remaining-chars (rng-forward))
(let ((pos (point)))
(setq continue
(and have-remaining-chars
(or (< pos limit)
(and continue-p-function
(funcall continue-p-function)
(setq limit (+ limit rng-validate-chunk-size))
t))))
(cond ((and rng-conditional-up-to-date-start
;; > because we are getting the state from (1- pos)
(> pos rng-conditional-up-to-date-start)
(< pos rng-conditional-up-to-date-end)
(rng-state-matches-current (get-text-property (1- pos)
'rng-state)))
(when (< remove-start (1- pos))
(rng-clear-cached-state remove-start (1- pos)))
;; sync up with cached validation state
(setq continue nil)
;; do this before setting rng-validate-up-to-date-end
;; in case we get a quit
(rng-mark-xmltok-errors)
(setq rng-validate-up-to-date-end
(marker-position rng-conditional-up-to-date-end))
(rng-clear-conditional-region)
(setq have-remaining-chars
(< rng-validate-up-to-date-end (point-max))))
((or (>= pos next-cache-point)
(not continue))
(setq next-cache-point (+ pos rng-state-cache-distance))
(with-silent-modifications
(rng-clear-cached-state remove-start pos))
(when have-remaining-chars
(rng-cache-state (1- pos)))
(setq remove-start pos)
(unless continue
;; if we have just blank chars skip to the end
(when have-remaining-chars
(skip-chars-forward " \t\r\n")
(when (= (point) (point-max))
(rng-clear-overlays pos (point))
(rng-clear-cached-state pos (point))
(setq have-remaining-chars nil)
(setq pos (point))))
(when (not have-remaining-chars)
(rng-process-end-document))
(rng-mark-xmltok-errors)
(setq rng-validate-up-to-date-end pos)
(when rng-conditional-up-to-date-end
(cond ((<= rng-conditional-up-to-date-end pos)
(rng-clear-conditional-region))
((< rng-conditional-up-to-date-start pos)
(set-marker rng-conditional-up-to-date-start
pos)))))))))
have-remaining-chars))