-import sys
+import sys, collections.abc
import xml.dom.minidom
class node(object):
return ob.__tonode__()
if type(ob) in self.nodeconv:
return self.nodeconv[type(ob)](ob)
- raise Exception("No node conversion known for %s objects" % str(type(ob)))
+ return None
def addchild(self, node, child):
if child is None:
return
- node.children.append(self.nodefrom(child))
+ new = self.nodefrom(child)
+ if new is not None:
+ node.children.append(self.nodefrom(child))
+ elif isinstance(child, collections.abc.Iterable):
+ for ch in child:
+ self.addchild(node, ch)
+ else:
+ raise Exception("No node conversion known for %s objects" % str(type(ob)))
def addattr(self, node, k, v):
if v is not None: