Skip to content

Commit

Permalink
Added multi-node-support for XML
Browse files Browse the repository at this point in the history
dploeger committed Nov 18, 2013
1 parent 2803d75 commit abec088
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -120,7 +120,8 @@ in XML this would look like this:
</RequestName>

All requests should conform to this dictionary format and the responses are
also returned in this format.
also returned in this format. Subnodes can also contain lists of
dictionaries, which will create multiple subnodes with the same tag.

Warning
-------
10 changes: 10 additions & 0 deletions pythonzimbra/tools/xmlserializer.py
Original file line number Diff line number Diff line change
@@ -31,6 +31,16 @@ def dict_to_dom(root_node, xml_dict):

root_node.appendChild(tmp_node)

elif type(value) == list:

for multinode in value:

tmp_node = root_node.ownerDocument.createElement(key)

dict_to_dom(tmp_node, multinode)

root_node.appendChild(tmp_node)

else:

# Attributes

0 comments on commit abec088

Please sign in to comment.