Archive of UserLand's first discussion group, started October 5, 1998.

Re: Is XML-RPC a scripting environment?

Author:A.M. Kuchling
Posted:1/20/1999; 6:20:13 AM
Topic:Frontier on MacOS X Server
Msg #:2294 (In response to 2293)
Prev/Next:2293 / 2295

Converting from the on-the-wire Boolean type to an integer or class instance isn't difficult. It's the other direction that's the problem; if the XML-RPC or WDDX marshaller sees an integer, is it *really* an integer, or is it a Boolean? Is a string like '1998-01-05' just a string, or is it a date?

In the marshalling code that's in the Python/XML CVS tree (this is different from Fredrik's code), it's handled by having two object instances that are called TRUE and FALSE. They have the right magic method defined so that "if (variable):" does the right thing, and you can write tests like "if (variable is TRUE):". Only these instances are marshalled into Boolean types, and an integer is then always an integer. I haven't really implemented anything for dates yet, but plan to do the same thing; dates will have to be an instance of some special class.

This means that you need to generate slightly special data structures for use with XML-RPC or WDDX, but that seems reasonably simple and can be handled in a thin conversion layer between the marshalling code and the database or service being wrapped.


There are responses to this message:


This page was archived on 6/13/2001; 4:47:25 PM.

© Copyright 1998-2001 UserLand Software, Inc.