(defun xmls::write-escaped (string stream) "Writes string to stream with all character entities escaped." (coerce string 'string) (when (eq stream t) (setf stream *standard-output*)) (dotimes (i (length string)) (let* ((char (char string i)) (code (char-code char))) (if (> code 255) ;; OOPS (format stream "&#~S;" code) (write-sequence (svref xmls::*char-escapes* code) stream)))))