Removed binding XML namespace experiments.

This commit is contained in:
Dann Martens 2011-01-13 11:37:58 +01:00
parent 3a12cdbd13
commit 0a3a7b5a70

View file

@ -91,121 +91,6 @@ def _py2xml(*args):
val.append(struct)
return val
#def py2xml(*args):
# params = ET.Element("{%s}params" % _namespace)
# for x in args:
# param = ET.Element("{%s}param" % _namespace)
# param.append(_py2xml(x))
# params.append(param) #<params><param>...
# return params
#
#def _py2xml(*args):
# for x in args:
# val = ET.Element("{%s}value" % _namespace)
# if x is None:
# nil = ET.Element("{%s}nil" % _namespace)
# val.append(nil)
# elif type(x) is int:
# i4 = ET.Element("{%s}i4" % _namespace)
# i4.text = str(x)
# val.append(i4)
# elif type(x) is bool:
# boolean = ET.Element("{%s}boolean" % _namespace)
# boolean.text = str(int(x))
# val.append(boolean)
# elif type(x) is str:
# string = ET.Element("{%s}string" % _namespace)
# string.text = x
# val.append(string)
# elif type(x) is float:
# double = ET.Element("{%s}double" % _namespace)
# double.text = str(x)
# val.append(double)
# elif type(x) is rpcbase64:
# b64 = ET.Element("{%s}Base64" % _namespace)
# b64.text = x.encoded()
# val.append(b64)
# elif type(x) is rpctime:
# iso = ET.Element("{%s}dateTime.iso8601" % _namespace)
# iso.text = str(x)
# val.append(iso)
# elif type(x) in (list, tuple):
# array = ET.Element("{%s}array" % _namespace)
# data = ET.Element("{%s}data" % _namespace)
# for y in x:
# data.append(_py2xml(y))
# array.append(data)
# val.append(array)
# elif type(x) is dict:
# struct = ET.Element("{%s}struct" % _namespace)
# for y in x.keys():
# member = ET.Element("{%s}member" % _namespace)
# name = ET.Element("{%s}name" % _namespace)
# name.text = y
# member.append(name)
# member.append(_py2xml(x[y]))
# struct.append(member)
# val.append(struct)
# return val
#def py2xml(*args):
# params = ET.Element("params", {'xmlns': _namespace})
# for x in args:
# param = ET.Element("param", {'xmlns': _namespace})
# param.append(_py2xml(x))
# params.append(param) #<params><param>...
# return params
#
#def _py2xml(*args):
# for x in args:
# val = ET.Element("value", {'xmlns': _namespace})
# if x is None:
# nil = ET.Element("nil", {'xmlns': _namespace})
# val.append(nil)
# elif type(x) is int:
# i4 = ET.Element("i4", {'xmlns': _namespace})
# i4.text = str(x)
# val.append(i4)
# elif type(x) is bool:
# boolean = ET.Element("boolean", {'xmlns': _namespace})
# boolean.text = str(int(x))
# val.append(boolean)
# elif type(x) is str:
# string = ET.Element("string", {'xmlns': _namespace})
# string.text = x
# val.append(string)
# elif type(x) is float:
# double = ET.Element("double", {'xmlns': _namespace})
# double.text = str(x)
# val.append(double)
# elif type(x) is rpcbase64:
# b64 = ET.Element("Base64", {'xmlns': _namespace})
# b64.text = x.encoded()
# val.append(b64)
# elif type(x) is rpctime:
# iso = ET.Element("dateTime.iso8601", {'xmlns': _namespace})
# iso.text = str(x)
# val.append(iso)
# elif type(x) in (list, tuple):
# array = ET.Element("array", {'xmlns': _namespace})
# data = ET.Element("data", {'xmlns': _namespace})
# for y in x:
# data.append(_py2xml(y))
# array.append(data)
# val.append(array)
# elif type(x) is dict:
# struct = ET.Element("struct", {'xmlns': _namespace})
# for y in x.keys():
# member = ET.Element("member", {'xmlns': _namespace})
# name = ET.Element("name", {'xmlns': _namespace})
# name.text = y
# member.append(name)
# member.append(_py2xml(x[y]))
# struct.append(member)
# val.append(struct)
# return val
def xml2py(params):
namespace = 'jabber:iq:rpc'
vals = []