From 54cd94af44379487ee3d1287216cc91651de16e1 Mon Sep 17 00:00:00 2001 From: iacopo Date: Tue, 7 Dec 2021 19:22:11 +0100 Subject: [PATCH] Fix parsing of article ID This fix avoids returning also the IDs of cited papers (they are within the ReferenceList element of the xml). Note: this issue was tracked as 22 on the original repository (now archived) An alternative XPath to be used: path = ".//PubmedData/ArticleIdList/ArticleId[@IdType='pubmed']" --- pymed/article.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymed/article.py b/pymed/article.py index 6068d4b6..4d660b48 100644 --- a/pymed/article.py +++ b/pymed/article.py @@ -47,7 +47,7 @@ def __init__( self.__setattr__(field, kwargs.get(field, None)) def _extractPubMedId(self: object, xml_element: TypeVar("Element")) -> str: - path = ".//ArticleId[@IdType='pubmed']" + path = "MedlineCitation/PMID" return getContent(element=xml_element, path=path) def _extractTitle(self: object, xml_element: TypeVar("Element")) -> str: