Function: RESOLVE-ENTITY

Documentation

Resolves the xml entity ENT to a character. Numeric entities are converted using CODE-CHAR, which only works in implementations that internally encode strings in US-ASCII, ISO-8859-1 or UCS.

Source

(defun resolve-entity (ent)
  "Resolves the xml entity ENT to a character.  Numeric entities are
converted using CODE-CHAR, which only works in implementations that
internally encode strings in US-ASCII, ISO-8859-1 or UCS."
  #-sb-unicode (declare (type simple-base-string ent))
  #+sb-unicode (declare (type string ent))
  (or (and (>= (length ent) 2)
           (char= (char ent 0) #\#)
           (code-char
            (if (char= (char ent 1) #\x)
                (parse-integer ent :start 2 :end (- (length ent) 1) :radix 16)
                (parse-integer ent :start 1 :end (- (length ent) 1)))))
      (second (assoc ent *entities* :test #'string=))
      (error 'unresovable-entity :entity ent)))
Source Context