570 |
param.appendChild(esysxml.createDataNode('Value', ' '.join([str(x) for x in value]) )) |
param.appendChild(esysxml.createDataNode('Value', ' '.join([str(x) for x in value]) )) |
571 |
elif isinstance(value, (str, bool, int, float, type(None))): |
elif isinstance(value, (str, bool, int, float, type(None))): |
572 |
param.appendChild(esysxml.createDataNode('Value', str(value))) |
param.appendChild(esysxml.createDataNode('Value', str(value))) |
573 |
|
elif isinstance(value, dict): |
574 |
|
dic = esysxml.createElement('dictionary') |
575 |
|
if len(value.keys())>0: |
576 |
|
dic.setAttribute('key_type', value.keys()[0].__class__.__name__) |
577 |
|
dic.setAttribute('value_type', value[value.keys()[0]].__class__.__name__) |
578 |
|
for k,v in value.items(): |
579 |
|
i=esysxml.createElement('item') |
580 |
|
i.appendChild(esysxml.createDataNode('key', k)) |
581 |
|
i.appendChild(esysxml.createDataNode('value', v)) |
582 |
|
dic.appendChild(i) |
583 |
|
param.appendChild(dic) |
584 |
else: |
else: |
585 |
|
print value |
586 |
raise ValueError("cannot serialize %s type to XML."%str(value.__class__)) |
raise ValueError("cannot serialize %s type to XML."%str(value.__class__)) |
587 |
|
|
588 |
node.appendChild(param) |
node.appendChild(param) |