[s-xml-rpc-devel] Re: [(nowhere)] Incorrect decoding of XML RPC messages

Sven Van Caekenberghe sven at beta9.be
Fri Apr 14 10:15:48 UTC 2006


Alain,

On 14 Apr 2006, at 07:32, Alain Picard wrote:

> Once upon a time (release 6, Januari 21, 2004) xml-rpc used to decode
> messages thusly:
>
> XML-RPC> (decode-xml-rpc (make-string-input-stream
>   "<value>
> <array>
> <data>
> </data>
> </array>
> </value>"))
> NIL
> XML-RPC>
>
> But now (2004-06-17  Rudi Schlatte  <rudi at constantly.at>),
> it does it this way:
> S-XML-RPC> (decode-xml-rpc (make-string-input-stream
>   "<value>
> <array>
> <data>
> </data>
> </array>
> </value>"))
> "
> "
>
> Which I think is COMPLETELY wrong.
>
> Whereas
> S-XML-RPC> (decode-xml-rpc (make-string-input-stream
>   "<value><array><data></data></array></value>"))
> NIL
>
> Is still OK.
>
> So I think something is wrong with the parser.

The handling of whitespace (or the significance of whitespace) in XML  
and especially in between elements is tricky. I know that it is  
allowed and sometimes significant. So I would say that it depends  
upon the XML application, in this case XML-RPC.

The XML-RPC spec is not superclear about all this. But what is clear  
is that a <data> element can only contain <value> elements and  
nothing else. So the simplest change that I could make to fix your  
testcase would be:

[sven at voyager:~/apps/clnet/s-xml-rpc/s-xml-rpc]$ cvs diff src/xml- 
rpc.lisp
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 -r1.8 xml-rpc.lisp
281c281
<         (:|data| (nreverse seed))
---
 >         (:|data| (unless (stringp seed) (nreverse seed)))

(I did not yet check this in).

This change comes down to the following: before, any subelements  
(including text and/or whitespace) of <data> were accepted as is;  
now, all text (whitespace or not) as subelement of <data> are ignored.

Does this work for you ?
Does anybody else have any opinion about this ?

Sven


--
Sven Van Caekenberghe - mailto:sven at beta9.be
Beta Nine - software engineering - http://www.beta9.be
.Mac - svc at mac.com - http://homepage.mac.com/svc

"Lisp isn't a language, it's a building material." - Alan Kay




More information about the S-xml-rpc-devel mailing list