xmlrpclib and decoding entity references

Kent Johnson kent37 at tds.net
Tue May 3 21:58:02 EDT 2005


Chris Curvey wrote:
> I'm writing an XMLRPC server, which is receiving a request (from a
> non-Python client) that looks like this (formatted for legibility):
> 
> <?xml version="1.0"?>
> <methodCall>
> <methodName>echo</methodName>
> <params>
> <param>
> <value>
> <string>Le Martyre de Saint Andr&#xe9; <BR> avec inscription
> 'Le Dominiquain.' et 'Le tableau fait par le dominicain,
> d'apr&#xe8;s son dessein &#xe0;... est &#xe0; Rome, &#xe0;
> l'&#xe9;glise Saint Andr&#xe9; della Valle' sur le
> cadre<BR> craie noire, plume et encre brune, lavis brun
> rehauss&#xe9; de blanc sur papier brun<BR> 190 x 228 mm. (7 1/2 x
> 9 in.)</string>
> </value>
> </param>
> </params>
> </methodCall>
> 
> But when my "echo" method is invoked, the value of the string is:
> 
> Le Martyre de Saint Andr; <BR> avec inscription 'Le Dominiquain.' et
> 'Le tableau fait par le dominicain, d'apr:s son dessein 2... est 2
> Rome, 2 l';glise Saint Andr; della Valle' sur le cadre<BR> craie noire,
> plume et encre brune, lavis brun rehauss; de blanc sur papier brun<BR>
> 190 x 228 mm. (7 1/2 x 9 in.)
> 
> Can anyone give me a lead on how to convert the entity references into
> something that will make it through to my method call?

Are you rolling your own XML parser? (Why?) An off-the-shelf parser should take care of this for 
you. Do you know about xmlrpclib and SimpleXMLRPCServer?

Kent



More information about the Python-list mailing list