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)
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)