pubmed_parser icon indicating copy to clipboard operation
pubmed_parser copied to clipboard

It couldn't recognize the xml file I downloaded from pubmed

Open wildwhip opened this issue 6 months ago • 6 comments

I have downloaded the xml file from "https://ftp.ncbi.nlm.nih.gov/pubmed/baseline/" and then

{
	"name": "XPathEvalError",
	"message": "Error in xpath expression",
	"stack": "---------------------------------------------------------------------------
XPathEvalError                            Traceback (most recent call last)
Cell In[14], line 3
      1 import pubmed_parser as pp
      2 path_xml = pp.list_xml_path(\"...\xml\")
----> 3 pubmed_dict = pp.parse_pubmed_xml(path_xml[0]) # dictionary output
      4 print(pubmed_dict)

File ......\\pubmed_parser\\pubmed_oa_parser.py:182, in parse_pubmed_xml(path, include_path, nxml)
    179     subjects = \"\"
    181 # create affiliation dictionary
****--> 182 affil_id = tree.xpath(\".//aff[@id]/@id\")****
    183 if len(affil_id) > 0:
    184     affil_id = list(map(str, affil_id))

File src\\\\lxml\\\\etree.pyx:2342, in lxml.etree._ElementTree.xpath()

File src\\\\lxml\\\\xpath.pxi:342, in lxml.etree.XPathDocumentEvaluator.__call__()

File src\\\\lxml\\\\xpath.pxi:210, in lxml.etree._XPathEvaluatorBase._handle_result()

XPathEvalError: Error in xpath expression"
}

wildwhip avatar Jul 29 '24 15:07 wildwhip