bonjour,
voici un exemple de fichier xml que je doit traiter :
Code XML : 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
27
28
29
30
31
32
33 <bibtex:file> <bibtex:entry id="MR2356985"> <bibtex:article> <bibtex:author>Akhmediev, Nail and Soto-Crespo, J. M. and Grelu, Philippe</bibtex:author> <bibtex:title>Spatiotemporal optical solitons in nonlinear dissipative media: from stationary light bullets to pulsating complexes</bibtex:title> <bibtex:journal>Chaos</bibtex:journal> <bibtex:fjournal>Chaos. An Interdisciplinary Journal of Nonlinear Science</bibtex:fjournal> <bibtex:volume>17</bibtex:volume> <bibtex:year>2007</bibtex:year> <bibtex:number>3</bibtex:number> <bibtex:pages>037112, 16</bibtex:pages> <bibtex:issn>1054-1500</bibtex:issn> <bibtex:coden>CHAOEH</bibtex:coden> <bibtex:mrclass>78A60 (35Q51 35Q55 35Q60)</bibtex:mrclass> <bibtex:mrnumber>MR2356985</bibtex:mrnumber> </bibtex:article> </bibtex:entry> <bibtex:entry id="MR2317453"> <bibtex:article> <bibtex:author>Cano, F. and Moussu, R. and Sanz, F.</bibtex:author> <bibtex:title>Nonoscillating projections for trajectories of vector fields</bibtex:title> <bibtex:journal>J. Dyn. Control Syst.</bibtex:journal> <bibtex:fjournal>Journal of Dynamical and Control Systems</bibtex:fjournal> <bibtex:volume>13</bibtex:volume> <bibtex:year>2007</bibtex:year> <bibtex:number>2</bibtex:number> <bibtex:pages>173--176</bibtex:pages> <bibtex:issn>1079-2724</bibtex:issn> <bibtex:mrclass>37C10</bibtex:mrclass> <bibtex:mrnumber>MR2317453</bibtex:mrnumber> </bibtex:article> </bibtex:entry> </bibtex:file>
Jusqu'a present je n'avai qu'une seul publication donc je n'avai pas de problème, mais se n'est plus le cas et cela me pause beaucoup de problème en effet ma méthode me permet d'afficher les resultats certe mais tout est melanger et je ne reussi plus a gere mes envoi d'information dans la base de données.
Que faire pour parser le fichier xml comme il faut afin d'envoyé les information dans la base de donnée ?
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73 $xml = simplexml_load_file('xml/'.$nom_sans_ext.'.xml'); foreach ($xml->xpath('//bibtex:entry') as $entry_xml) { $id=$entry_xml['id']; echo 'l\'id de l\'entry est :'.$id.'<br><br>'; //** Gestion des differents type de de document //si c'est un article if ($entry_xml->xpath('//bibtex:article')) { $type_xml = 'article'; foreach ($entry_xml->xpath('//bibtex:article') as $article_xml) { foreach ($article_xml->xpath('//bibtex:author') as $author_xml) { echo $author_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:title') as $title_xml) { echo $title_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:journal') as $journal_xml) { echo $journal_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:fjournal') as $fjournal_xml) { echo $fjournal_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:volume') as $volume_xml) { echo $volume_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:year') as $year_xml) { echo $year_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:number') as $number_xml) { echo $number_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:pages') as $pages_xml) { echo $pages_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:issn') as $issn_xml) { echo $issn_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:coden') as $coden_xml) { echo $coden_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:mrclass') as $mrclass_xml) { echo $mrclass_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:mrnumber') as $mrnumber_xml) { echo $mrnumber_xml.'<br><br>'; } foreach ($article_xml->xpath('//bibtex:mrreviewer') as $mrreviewer_xml) { echo $mrreviewer_xml.'<br><br>'; } } } //Si c'est un incollection elseif ($entry_xml->xpath('//bibtex:incollection')) { $type_xml = 'incollection'; }
Ou peut on solutionner le problème par un simple envoie dans la base de donner au milieu du code de traitement du xml ?







Répondre avec citation
Partager