I'm writeing an xmlrpc server and I'm running into problems because when I'm sent a string with outside whitespace that whitespace is ignored. For example " white space " sent by the client is received as "white space". I've been looking around at all the options I can find and can't seem to figure out a way to make it accept the whitespace. Is there a way to do this or is whitespace on the ends of the strings unsupported by this implementation of xmlrpc?
Unfortunately this is not possible the way you do it now. The parser trims the character data in the XML elements in the message. This is necessary since an XML-RPC message may include new lines after an opening value tag and before a closing value tag, and not stripping leading and trailing spaces would most likely lead to a lot of problems for people, depending on which XML-RPC client they use. This is true for many other XML-RPC parsers I would assume.
It would be quite possible to patch the XmlRpcParser class in the library to skip the trimming in the consumeCharData() method. Another solution would to decide that your XML-RPC API that you are designing uses leading and trailing underscores or something to represent spaces, and your invocation handler on the server replaces these with spaces during invocation.
Sorry that I can't help you out. If you like, I can create a patched version of the library later tonight if its not possible for you to build the library from source.
Unfortunately I can't change the API because it's already in place, I'd prefer to avoid the gory details. I can understand why it you would need to trim whitespace for most applications, I was just hopeing that there was an option you could set somewhere that would let it use the whitespace if you wanted it to, say a "myServer.ignoreWhitespace(false)" or something along those lines. I could probably get through patching it on my own, I was just hopeing I wouldn't have to. Thanks anyway, though if you have the ability to modify the code on the project (I don't realy know how sourceforge works this is the first time I've done anything with it) adding a little option function somewhere would seem to be a nice feature to me.
Thanks for your help
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.