0

I have a long xml file containing articles data , I want to extract some of them (pmid,doi,abstract)and I have a file containing the "PMID" or "Titles" of the articles I need to take , How could I do it? This is the link to the xml file : https://github.com/r03ert0/brainspell/blob/master/data/brainspell-15July2014.xml.zip

Thanks in advance

nouss
  • 9
  • 1

2 Answers2

0

Use PHP SimpleXML Parser. Example:

$xml = simplexml_load_file("file");

Then you can use $xml to access different attributes:

echo $xml->pmid;
Ivan Velchev
  • 75
  • 1
  • 1
  • 9
0

Well, it's not really the idea to find people for writing you some free code, but let me help you out...

First, learn working with the simplexml function.

Then you just have to loop through the object and you have the access to your needed fields:

$xml = simplexml_load_file('testfile.xml');
$pmid = $xml->paper[0]->pmid[0]
print_r($pmid);

Here, the PMID is already saved in a variable.

Kind regards

Matt Backslash
  • 764
  • 1
  • 8
  • 20