[s-xml-rpc-devel] Re: Bug in s-xml-rpc::encode-xml-rpc-call
Sven Van Caekenberghe
scaekenberghe at common-lisp.net
Wed Dec 21 15:58:10 UTC 2005
Alain,
If I understand your fix correctly, you want to interpret NIL
immediately as an empty array.
Before, NIL was interpreted as a boolean, no ?
What would be best ?
In CL, this very convenient fact (false == empty list) is a problem
when you want auto typing of arguments.
Any other opinions ?
Sven
On 21 Dec 2005, at 05:09, Alain.Picard at memetrics.com wrote:
> Hi Sven!
>
>> I note that empty arrays and empty lists are not treated
>> similarly, to wit:
>
> This definition of encode-xml-rpc-value
> fixes the problem I just reported:
>
> (defun encode-xml-rpc-value (arg stream)
> (write-string "<value>" stream)
> (cond ((null arg)
> (encode-xml-rpc-array arg 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))
> ((or (null arg) (eq 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)
> '(unsigned-byte 8)))
> (write-string "<base64>" stream)
> (encode-base64-bytes arg stream)
> (write-string "</base64>" stream))
> ((xml-rpc-time-p arg)
> (write-string "<dateTime.iso8601>" stream)
> (universal-time->iso8601 (xml-rpc-time-universal-time arg) stream)
> (write-string "</dateTime.iso8601>" stream))
> ((xml-literal-p arg)
> (write-string (xml-literal-content arg) stream))
> ((or (listp arg) (vectorp arg)) (encode-xml-rpc-array arg stream))
> ((xml-rpc-struct-p arg) (encode-xml-rpc-struct arg stream))
> ;; add generic method call
> (t (error "cannot encode ~s" arg)))
> (write-string "</value>" stream))
>
> Cheers,
> --ap
More information about the S-xml-rpc-devel
mailing list