def _extract_aliases_from_pmid(self, page, pmid):
        (doc, lookup_function) = provider._get_doc_from_xml(page)
        doi = None
        pmc = None
        try:
            articleidlist = doc.getElementsByTagName("ArticleIdList")[0]
            for articleid in articleidlist.getElementsByTagName("ArticleId"):
                if (articleid.getAttribute("IdType") == u"doi"):
                    doi = articleid.firstChild.data
                if (articleid.getAttribute("IdType") == u"pmc"):
                    pmc = articleid.firstChild.data

            if not doi:
                #give it another try, in another part of the xml 
                # see http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=23682040&retmode=xml&email=team@total-impact.org&tool=total-impact
                article = doc.getElementsByTagName("Article")[0]
                for elocationid in article.getElementsByTagName("ELocationID"):
                    if (elocationid.getAttribute("EIdType") == u"doi"):
                        if (elocationid.getAttribute("ValidYN") == u"Y"):
                            doi = elocationid.firstChild.data

        except (IndexError, __HOLE__):
            pass

        #sometimes no doi, or PMID has a doi-fragment in the doi field:
        aliases_list = []
        if doi:
            if "10." in doi:  
                aliases_list += [("doi", doi), ("url", "http://dx.doi.org/"+doi)]
        if pmc:
            aliases_list += [("pmc", pmc), ("url", "http://www.ncbi.nlm.nih.gov/pmc/articles/"+pmc)]

        return aliases_list
dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpact/providers/pubmed.py/Pubmed._extract_aliases_from_pmid