Function: xmltok-get-declared-encoding-position
xmltok-get-declared-encoding-position is an autoloaded and
byte-compiled function defined in xmltok.el.gz.
Signature
(xmltok-get-declared-encoding-position &optional LIMIT)
Documentation
Return the position of the encoding in the XML declaration at point.
If there is a well-formed XML declaration starting at point and it contains an encoding declaration, then return (START . END) where START and END are the positions of the start and the end of the encoding name; if there is no encoding declaration return the position where and encoding declaration could be inserted. If there is XML that is not well-formed that looks like an XML declaration, return nil. Otherwise, return t. If LIMIT is non-nil, then do not consider characters beyond LIMIT.
Source Code
;; Defined in /usr/src/emacs/lisp/nxml/xmltok.el.gz
;;;###autoload
(defun xmltok-get-declared-encoding-position (&optional limit)
"Return the position of the encoding in the XML declaration at point.
If there is a well-formed XML declaration starting at point and it
contains an encoding declaration, then return (START . END)
where START and END are the positions of the start and the end
of the encoding name; if there is no encoding declaration return
the position where and encoding declaration could be inserted.
If there is XML that is not well-formed that looks like an XML
declaration, return nil. Otherwise, return t.
If LIMIT is non-nil, then do not consider characters beyond LIMIT."
(cond ((let ((case-fold-search nil))
(and (looking-at (xmltok-xml-declaration regexp))
(or (not limit) (<= (match-end 0) limit))))
(let ((end (xmltok-xml-declaration end encoding-value)))
(if end
(cons (1+ (xmltok-xml-declaration start encoding-value))
(1- end))
(or (xmltok-xml-declaration end version-value)
(+ (point) 5)))))
((not (let ((case-fold-search t))
(looking-at xmltok-bad-xml-decl-regexp))))))