From scaekenberghe at common-lisp.net Mon Jan 24 10:03:10 2005 From: scaekenberghe at common-lisp.net (Sven Van Caekenberghe) Date: Mon, 24 Jan 2005 02:03:10 -0800 (PST) Subject: [s-xml-cvs] CVS update: s-xml/src/xml.lisp Message-ID: <20050124100310.B73388802B@common-lisp.net> Update of /project/s-xml/cvsroot/s-xml/src In directory common-lisp.net:/tmp/cvs-serv27989/src Modified Files: xml.lisp Log Message: added :start and :end keywords to print-string-xml Date: Mon Jan 24 02:03:09 2005 Author: scaekenberghe Index: s-xml/src/xml.lisp diff -u s-xml/src/xml.lisp:1.5 s-xml/src/xml.lisp:1.6 --- s-xml/src/xml.lisp:1.5 Fri Oct 22 03:36:58 2004 +++ s-xml/src/xml.lisp Mon Jan 24 02:03:09 2005 @@ -1,6 +1,6 @@ ;;;; -*- mode: lisp -*- ;;;; -;;;; $Id: xml.lisp,v 1.5 2004/10/22 10:36:58 scaekenberghe Exp $ +;;;; $Id: xml.lisp,v 1.6 2005/01/24 10:03:09 scaekenberghe Exp $ ;;;; ;;;; This is a Common Lisp implementation of a very basic XML parser. ;;;; The parser is non-validating and not at all complete (no CDATA). @@ -80,9 +80,10 @@ :adjustable t :fill-pointer 0)) -(defun print-string-xml (string stream) +(defun print-string-xml (string stream &key (start 0) end) "Write the characters of string to stream using basic XML conventions" - (loop for char across string + (loop for offset upfrom start below (or end (length string)) + for char = (char string offset) do (case char (#\& (write-string "&" stream)) (#\< (write-string "<" stream))