r5036: *** empty log message ***
[kmrcl.git] / xml-utils.lisp
index 20029fe109a29b449736cffb0955099790c73e1e..be7952bfedad0f612311db2d5f4553771301447b 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id: xml-utils.lisp,v 1.6 2002/12/04 16:49:23 kevin Exp $
+;;;; $Id: xml-utils.lisp,v 1.7 2003/05/26 21:43:05 kevin Exp $
 ;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -91,3 +91,15 @@ and position of character following end tag."
 (defun xml-cdata (str)
   (concatenate 'string "<![CDATA[" str "]]>"))
 
+(defun write-xml-cdata (str s)
+  (declare (simple-string str) (optimize (speed 3) (safety 0)))
+  (do* ((len (length str))
+       (i 0 (1+ i)))
+       ((= i len) str)
+    (declare (fixnum i len))
+    (let ((c (schar str i)))
+      (case c
+       (#\< (write-string "&lt;" s))
+       (#\& (write-string "&amp;" s))
+       (t   (write-char c s))))))
+