X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=python%2Fxmltemplate.py;h=b24d7642ccda30a0173ccd345fc413a313e19dbd;hb=8e1d37633979005acd694fc86ee91b724fe4361b;hp=94135251089c1df5e7ae3bf966be17b0e36d1a45;hpb=299dc26d42d1bde161e8bb4a4d1db50917fe24d0;p=xml-template diff --git a/python/xmltemplate.py b/python/xmltemplate.py index 9413525..b24d764 100644 --- a/python/xmltemplate.py +++ b/python/xmltemplate.py @@ -8,7 +8,7 @@ def process_file(filename, obj, clean = True): return doc def process(node, obj, clean = True): - if isinstance(obj, str): # overwrite + if isinstance(obj, basestring): # overwrite while not node.firstChild is None: node.removeChild(node.firstChild) doc = _get_document_element(node) @@ -35,8 +35,8 @@ def process(node, obj, clean = True): attrs_to_remove = [] if not attrs is None: for i in range(attrs.length): - attr = attrs.item(0) - if attr.namespaceURI == "http://template.sesse.net/" or attr.name == "id": + attr = attrs.item(i) + if attr.namespaceURI == "http://template.sesse.net/" and attr.localName == "id": id = attr.value if clean: attrs_to_remove.append(attr.name)