import lxml.etree class JClic: def __init__(self,string_xml): #print "JClic: __init__" self.title="" self.date="" readycount = 0 root = lxml.etree.fromstring(string_xml) for node in root: if node.tag =="settings": for snode in node: if snode.tag == "revision": self.date = snode.get("date") if snode.tag == "title": if snode.text=="Sin nombre" or snode.text=="Sense nom": self.title=root.get("name") else: self.title = snode.text break