Commit 17975d7f authored by Chong Yidong's avatar Chong Yidong
Browse files

* xml.el (xml-escape-string): Don't refer to xml-entity-alist.

Fixes: debbugs:12228
parent d7191076
2012-08-19 Chong Yidong <>
* xml.el (xml-escape-string): Don't refer to xml-entity-alist
2012-08-18 Chong Yidong <>
* simple.el (yank-handled-properties): New defcustom.
......@@ -1011,13 +1011,25 @@ The first line is indented with the optional INDENT-STRING."
(defalias 'xml-print 'xml-debug-print)
(defun xml-escape-string (string)
"Return STRING with entity substitutions made from `xml-entity-alist'."
(mapconcat (lambda (byte)
(let ((char (char-to-string byte)))
(if (rassoc char xml-entity-alist)
(concat "&" (car (rassoc char xml-entity-alist)) ";")
string ""))
"Convert STRING into a string containing valid XML character data.
Replace occurrences of &<>'\" in STRING with their default XML
entity references (e.g. replace each & with &amp;).
XML character data must not contain & or < characters, nor the >
character under some circumstances. The XML spec does not impose
restriction on \" or ', but we just substitute for these too
\(as is permitted by the spec)."
(insert string)
(dolist (substitution '(("&" . "&amp;")
("<" . "&lt;")
(">" . "&gt;")
("'" . "&apos;")
("\"" . "&quot;")))
(goto-char (point-min))
(while (search-forward (car substitution) nil t)
(replace-match (cdr substitution) t t nil)))
(defun xml-debug-print-internal (xml indent-string)
"Outputs the XML tree in the current buffer.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment