def endElement(self, name):

        # print name, self.obsolete, self.namespace #, self.elementNamespace

        if name == "id":
            self.goid = self.cdata.strip()
            self.goNode.setGOID(self.goid)

        elif name == "namespace":
            self.elementNamespace = self.cdata.strip()
            self.goNode.setNamespace(self.elementNamespace)

        elif name == "is_a" and not self.inTypedef:
            self.parents.append(self.cdata.strip())
            self.goNode.setParents(self.parents)

        elif name == "type":
            self.relationship_type = self.cdata.strip()

        elif name == "relationship" and not self.inTypedef:
            # add relationships into graph - this includes 'part_of'
            # but excludes 'negatively_regulates',
            # 'positively_regulates' and 'regulates' and others
            if self.relationship_type == "part_of":
                self.parents.append(self.cdata.strip())
                self.goNode.setParents(self.parents)

        elif name == "is_obsolete" and self.cdata.strip() == "1":
            self.obsolete = True
            self.goNode.setObsolete(self.obsolete)

        elif name == "typedef":
            self.inTypedef = False

        elif name == "alt_id":
            self.synonyms[self.cdata.strip()] = self.goid

        elif (name == "term" and
              not self.obsolete and
              self.namespace == self.elementNamespace):

            '''# not sure what the follow trying to do
            if not self.elementNamespace in self.namespaces.keys():
                self.namespaces[self.elementNamespace] = []

            self.namespaces[self.elementNamespace].append(self.goid)
            '''

            self.graph.add_node(self.goid, data=self.goNode)
            for parent in self.parents:
                '''currently the only edges being added are to the children of the
                current node
                '''
                if parent not in self.graph:
                    self.graph.add_node(parent, data=GONode(parent))
                self.graph.add_edge(
                    parent, self.goid, relationship="parent_of")

        # and not self.name.has_key(self.goid):
        elif (name == "name" and
              not self.obsolete and
              self.goid is not None and self.goNode.name is None):
            self.goNode.setName(self.cdata.strip())

        # and not self.name.has_key(self.goid):
        elif (name == "defstr" and
              not self.obsolete and
              self.goid is not None):
            self.goNode.setDescription(self.cdata.strip())

        elif (name == "term" and
              self.obsolete and
              self.namespace == self.elementNamespace):
            self.obsoletes.add(self.goid)
dataset/ETHPy150Open CGATOxford/cgat/scripts/revigo.py/GOOboXmlHandler.endElement/original