Index: src/xml-rpc.lisp
===================================================================
RCS file: /project/s-xml-rpc/cvsroot/s-xml-rpc/src/xml-rpc.lisp,v
retrieving revision 1.8
diff -c -r1.8 xml-rpc.lisp
*** src/xml-rpc.lisp	9 Jan 2006 19:33:47 -0000	1.8
--- src/xml-rpc.lisp	19 Apr 2006 10:01:01 -0000
***************
*** 49,54 ****
--- 49,68 ----
        (documentation 'xml-rpc-error-data 'function)
        "Get the data from an XML-RPC error")
  
+ ;;; whitespace handling support
+ 
+ (defparameter +whitespace-characters+
+   '(#\Tab #\Space #\Page #\Return #\Newline #\Linefeed)
+   "The list of characters that we consider as whitespace")
+  
+ (defun whitespace-char? (char) 
+   "Return t when char is considered whitespace"
+   (member char +whitespace-characters+ :test #'char=))
+ 
+ (defun whitespace-string? (str)
+   "Return t when str consists of nothing but whitespace characters"
+   (every #'whitespace-char? str))
+ 
  ;;; iso8601 support (the xml-rpc variant)
  
  (defun universal-time->iso8601 (time &optional (stream nil))
***************
*** 67,72 ****
--- 81,87 ----
  (defun iso8601->universal-time (string)
    "Convert string in the XML-RPC variant of ISO8601 to a Common Lisp universal time"
    (let (year month date (hour 0) (minute 0) (second 0))
+     (setf string (string-trim +whitespace-characters+ string))
      (when (< (length string) 9)
        (error "~s is to short to represent an iso8601" string))
      (setf year (parse-integer string :start 0 :end 4)
***************
*** 188,203 ****
  
  (defun encode-xml-rpc-value (arg stream)
    (write-string "<value>" stream)
!   (cond ((or (stringp arg) (symbolp arg))
  	 (write-string "<string>" stream)
  	 (print-string-xml (string arg) stream)
  	 (write-string "</string>" stream))
  	((integerp arg) (format stream "<int>~d</int>" arg))
  	((floatp arg) (format stream "<double>~f</double>" arg))
- 	((or (null arg) (eql arg t))
- 	 (write-string "<boolean>" stream)
- 	 (write-string (if arg "1" "0") stream)
- 	 (write-string "</boolean>" stream))
  	((and (arrayp arg)
  	      (= (array-rank arg) 1)
  	      (subtypep (array-element-type arg)
--- 203,218 ----
  
  (defun encode-xml-rpc-value (arg stream)
    (write-string "<value>" stream)
!   (cond ((or (null arg) (eql arg t))
! 	 (write-string "<boolean>" stream)
! 	 (write-string (if arg "1" "0") stream)
! 	 (write-string "</boolean>" stream))
! 	((or (stringp arg) (symbolp arg))
  	 (write-string "<string>" stream)
  	 (print-string-xml (string arg) stream)
  	 (write-string "</string>" stream))
  	((integerp arg) (format stream "<int>~d</int>" arg))
  	((floatp arg) (format stream "<double>~f</double>" arg))
  	((and (arrayp arg)
  	      (= (array-rank arg) 1)
  	      (subtypep (array-element-type arg)
***************
*** 269,275 ****
    (declare (ignore attributes))
    (cons (case name
  	  ((:|int| :|i4|) (parse-integer seed))
! 	  (:|double| (read-from-string seed))
  	  (:|boolean| (= 1 (parse-integer seed)))
  	  (:|string| (if (null seed) "" seed))
  	  (:|dateTime.iso8601| (xml-rpc-time (iso8601->universal-time seed)))
--- 284,291 ----
    (declare (ignore attributes))
    (cons (case name
  	  ((:|int| :|i4|) (parse-integer seed))
! 	  (:|double| (let ((*read-eval* nil))
!                        (read-from-string seed)))
  	  (:|boolean| (= 1 (parse-integer seed)))
  	  (:|string| (if (null seed) "" seed))
  	  (:|dateTime.iso8601| (xml-rpc-time (iso8601->universal-time seed)))
***************
*** 278,285 ****
  		       (with-input-from-string (in seed)
  			 (decode-base64-bytes in))))
  	  (:|array| (car seed))
! 	  (:|data| (nreverse seed))
! 	  (:|value| (if (stringp seed) seed (car seed)))
  	  (:|struct| (make-xml-rpc-struct :alist seed))
  	  (:|member| (cons (cadr seed) (car seed)))
  	  (:|name| (intern seed :keyword))
--- 294,303 ----
  		       (with-input-from-string (in seed)
  			 (decode-base64-bytes in))))
  	  (:|array| (car seed))
! 	  (:|data| (unless (stringp seed) (nreverse seed)))
! 	  (:|value| (cond ((stringp seed) seed)
!                           ((null (car seed)) "")
!                           (t (car seed))))
  	  (:|struct| (make-xml-rpc-struct :alist seed))
  	  (:|member| (cons (cadr seed) (car seed)))
  	  (:|name| (intern seed :keyword))
