Function: xml-parse-attlist
xml-parse-attlist is a byte-compiled function defined in xml.el.gz.
Signature
(xml-parse-attlist &optional XML-NS)
Documentation
Return the attribute-list after point.
Leave point at the first non-blank character after the tag.
Source Code
;; Defined in /usr/src/emacs/lisp/xml.el.gz
(defun xml-parse-attlist (&optional xml-ns)
"Return the attribute-list after point.
Leave point at the first non-blank character after the tag."
(let ((attlist ())
end-pos name)
(skip-syntax-forward " ")
(while (looking-at (eval-when-compile
(concat "\\(" xml-name-re "\\)\\s-*=\\s-*")))
(setq end-pos (match-end 0))
(setq name (xml-maybe-do-ns (match-string-no-properties 1) nil xml-ns))
(goto-char end-pos)
;; See also: https://www.w3.org/TR/2000/REC-xml-20001006#AVNormalize
;; Do we have a string between quotes (or double-quotes),
;; or a simple word ?
(if (looking-at "\"\\([^\"]*\\)\"")
(setq end-pos (match-end 0))
(if (looking-at "'\\([^']*\\)'")
(setq end-pos (match-end 0))
(error "XML: (Not Well-Formed) Attribute values must be given between quotes")))
;; Each attribute must be unique within a given element
(if (assoc name attlist)
(error "XML: (Not Well-Formed) Each attribute must be unique within an element"))
(let ((string (match-string-no-properties 1)))
(let ((expansion (xml-substitute-special string)))
(unless (stringp expansion)
;; We say this is the constraint. It is actually that
;; neither external entities nor "<" can be in an
;; attribute value.
(error "XML: (Not Well-Formed) Entities in attributes cannot expand into elements"))
(push (cons name expansion) attlist)))
(goto-char end-pos)
(skip-syntax-forward " "))
(nreverse attlist)))