Bonjour a tous
j'essaie de parser ce fichier xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 <eSummaryResult> <DocSum> <Id>23550686</Id> <Item Name="PubDate" Type="Date">2013 Apr 4</Item> Año mes dia <Item Name="EPubDate" Type="Date"/> <Item Name="Source" Type="String">N Engl J Med</Item> <Item Name="AuthorList" Type="List"> <Item Name="Author" Type="String">Zehetner C</Item> <Item Name="Author" Type="String">Bechrakis N</Item> </Item> <Item Name="LastAuthor" Type="String">Bechrakis N</Item> <Item Name="Title" Type="String">Images in clinical medicine. Stellate cataract.</Item> Título del artículo <Item Name="Volume" Type="String">368</Item> Volumen <Item Name="Issue" Type="String">14</Item> Fascículo de la revista <Item Name="Pages" Type="String">e18</Item> Páginas Inicio y final (creo que e=end) <Item Name="LangList" Type="List"> <Item Name="Lang" Type="String">English</Item> </Item> <Item Name="NlmUniqueID" Type="String">0255562</Item> <Item Name="ISSN" Type="String">0028-4793</Item> <Item Name="ESSN" Type="String">1533-4406</Item> <Item Name="PubTypeList" Type="List"> <Item Name="PubType" Type="String">Journal Article</Item> </Item> </DocSum> </eSummaryResult>
Avec ce code PHP
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <?php $url = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&id=23565222"; $xml = simplexml_load_file($url); foreach($xml->result->DocSum->row as $key=>$row){ foreach($row->Item as $key => $value){ echo $value['Name']." => "; echo $value."<br />"; } } ?>
Rien ne s'affiche a l'ecran, je ne suis pas sur que le code soit le correcte, quelqu'un connais la façon de recuperer des données?
Si oui, pourriez-vous poster un exemple?
Cecie est la sortie de print_r($xml)
D'avance merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part SimpleXMLElement Object ( [DocSum] => SimpleXMLElement Object ( [Id] => 23565222 [Item] => Array ( [0] => 2013 [1] => 2013 Apr 2 [2] => PLoS One [3] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => AuthorList [Type] => List ) [Item] => Array ( [0] => Lalremruata A [1] => Ball M [2] => Bianucci R [3] => Welte B [4] => Nerlich AG [5] => Kun JF [6] => Pusch CM ) ) [4] => Pusch CM [5] => Molecular identification of falciparum malaria and human tuberculosis co-infections in mummies from the fayum depression (lower egypt). [6] => 8 [7] => 4 [8] => e60307 [9] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => LangList [Type] => List ) [Item] => English ) [10] => 101285081 [11] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => ISSN [Type] => String ) ) [12] => 1932-6203 [13] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => PubTypeList [Type] => List ) [Item] => Journal Article ) [14] => PubMed - in process [15] => ppublish+epublish [16] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => ArticleIds [Type] => List ) [Item] => Array ( [0] => 10.1371/journal.pone.0060307 [1] => PONE-D-12-39756 [2] => 23565222 [3] => PMC3614933 [4] => 23565222 [5] => 23565222 [6] => pmc-id: PMC3614933; ) ) [17] => 10.1371/journal.pone.0060307 [18] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => History [Type] => List ) [Item] => Array ( [0] => 2012/12/16 00:00 [1] => 2013/02/25 00:00 [2] => 2013/04/02 00:00 [3] => 2013/04/09 06:00 [4] => 2013/04/09 06:00 [5] => 2013/04/09 06:00 ) ) [19] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => References [Type] => List ) ) [20] => 1 [21] => 0 [22] => PloS one [23] => doi: 10.1371/journal.pone.0060307 [24] => 2013;8(4):e60307 ) ) )
Partager