'Creates new node (if not already present) with name "tag"
and sets it\'s attribute "attr" to value "val".'

def setTagAttr(self, tag, attr, val):

    try:
        self.getTag(tag).attrs[attr] = val
    except:
        self.addChild(tag, attrs={attr: val})
