Bonjour,
Tout d'abord j'espère ne pas m'être trompé de forum pour poster mon problème. mais comme il s'agit d'une gestion de fichier, ici XML, je pense que c'est bon.
Comme d'habitude je vais essayer de faire simple.
Pour commencer, mon XML :
Et maintenant, mon code PHP :
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<?xml version="1.0" encoding="UTF-8"?> <main> <image type="image1"> <titre>TEST : TOM CLANCY ENDWAR</titre> <affiche>une/image/endwar.jpg</affiche> <article><a href="http://www.gametest.fr/index.php?page=affichagetest&id=36">http://www.gametest.fr/index.php?page=affichagetest&id=36</a></article> </image> <image type="image2"> <titre>TEST : GEARS OF WAR 2</titre> <affiche>une/image/gears_of_war_2.jpg</affiche> <article><a href="http://www.gametest.fr/index.php?page=affichagetest&id=35">http://www.gametest.fr/index.php?page=affichagetest&id=35</a></article> </image> <image type="image3"> <titre>TEST : FABLE II</titre> <affiche>une/image/fable_2.jpg</affiche> <article><a href="http://www.gametest.fr/index.php?page=affichagetest&id=34">http://www.gametest.fr/index.php?page=affichagetest&id=34</a></article> </image> </main>
Quoi de plus simple me direz-vous? Oui mais voilà le lus beau, le message d'erreur que je ne comprend pas :
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 if (file_exists('../une/diapo.xml')) { $xml = simplexml_load_file('../une/diapo.xml'); echo "<hr>Here is a dump of the data structure:"; echo "<pre>"; print_r($xml); echo "</pre>"; } else { exit('Failed to open story.xml.'); }
Warning: simplexml_load_file() [function.simplexml-load-file]: ../une/diapo.xml:6: parser error : EntityRef: expecting ';' in H:\Site_Web\EasyPHP 2.0b1\www\gametest\admin_2\une.php on line 9
Warning: simplexml_load_file() [function.simplexml-load-file]: <article>http://www.gametest.fr/index.php?page=affichagetest&id=36</article> in H:\Site_Web\EasyPHP 2.0b1\www\gametest\admin_2\une.php on line 9
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in H:\Site_Web\EasyPHP 2.0b1\www\gametest\admin_2\une.php on line 9
Warning: simplexml_load_file() [function.simplexml-load-file]: ../une/diapo.xml:11: parser error : EntityRef: expecting ';' in H:\Site_Web\EasyPHP 2.0b1\www\gametest\admin_2\une.php on line 9
Warning: simplexml_load_file() [function.simplexml-load-file]: <article>http://www.gametest.fr/index.php?page=affichagetest&id=35</article> in H:\Site_Web\EasyPHP 2.0b1\www\gametest\admin_2\une.php on line 9
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in H:\Site_Web\EasyPHP 2.0b1\www\gametest\admin_2\une.php on line 9
Warning: simplexml_load_file() [function.simplexml-load-file]: ../une/diapo.xml:16: parser error : EntityRef: expecting ';' in H:\Site_Web\EasyPHP 2.0b1\www\gametest\admin_2\une.php on line 9
Warning: simplexml_load_file() [function.simplexml-load-file]: <article>http://www.gametest.fr/index.php?page=affichagetest&id=34</article> in H:\Site_Web\EasyPHP 2.0b1\www\gametest\admin_2\une.php on line 9
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in H:\Site_Web\EasyPHP 2.0b1\www\gametest\admin_2\une.php on line 9
Pour info la ligne 9 correspond au chargement du xml avec simpxml_load_file().
Une aute info aussi, ça fait juste une heure que je m'entête à trouver mon erreur, que je ne trouve pas...
Partager