Skip to content

write_child_node need to help str node_type #16

Description

@athensofamerica

The write_child_node defined in utils.py needs handle special case for str node type.

def write_child_node(xmlnode, tag_name, node):
if node:
xmldoc = xmlnode if isinstance(xmlnode, minidom.Document) else xmlnode.ownerDocument
if isinstance(node, list):
for n in node:
new_elem = xmldoc.createElement(tag_name)
#n.write(new_elem) #This doesn't work for str type. exception throws. Add the following 4 lines of code seems to solved the problem.
if isinstance(n, str) or isinstance(n, unicode):
write_node_value(new_elem, n)
else:
n.write(new_elem)

xmlnode.appendChild(new_elem)
else:
new_elem = xmldoc.createElement(tag_name)
node.write(new_elem)
xmlnode.appendChild(new_elem)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions