xml+caractère & pose problème à php
Bonjour, ou rebonjour pour ceux qui ont lu mon précédent post.
J'ai un petit soucis sur la lecture de mon fichier xml par php.
J'utilise la méthode :
Code:
1 2 3 4 5 6 7 8
| if (file_exists('PlanningInfos/PlanningInfos.xml')) {
$xml = simplexml_load_file('PlanningInfos/PlanningInfos.xml');
//attribue le noued du stage en cours dans la variable $content
$content = $xml->$categ->stages[$stage];
//récupère la partie nombre du tarif pour éviter 'euros'"
$tarif = strpos($content['tarif']," ");
$tarif = substr($content['tarif'], 0, $tarif);
} |
pour lire mon xml.
Jusque là, aucun problème (grâce à ce forum).
Mon soucis est que dans mon xml, qui est lu par flash et par php sur 2 pages différentes, j'ai besoin d'indiquer l'adresse à utiliser pour flash qui se compose comme ceci:
http://127.0.0.1/site/index.php?page...glais1&stage=0
or, quand j'insère cette adresse dans mon xml dans un attribut en tant que string :
Code:
<stages titre="Stage FCL 1.028 (IFR-VFR)" date="Du 12/01 au 16/01." heures="30 Heures." programme="Ecoute, phrases d'urgence, vols fictifs." lieu="Toulouse" places="8 places" tarif="620 euros" type="1028" urlParams="page=paiement&type=anglais&categ=anglais1&stage=0"/>
PHP plante et m'affiche:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Warning: simplexml_load_file() [function.simplexml-load-file]: PlanningInfos/PlanningInfos.xml:8: parser error : EntityRef: expecting ';' in C:\Program Files\EasyPHP 2.0b1\www\site\php\pages\paiement.php on line 11
Warning: simplexml_load_file() [function.simplexml-load-file]: e" places="8 places" tarif="620 euros" type="1028" urlParams="page=paiement&type in C:\Program Files\EasyPHP 2.0b1\www\site\php\pages\paiement.php on line 11
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in C:\Program Files\EasyPHP 2.0b1\www\site\php\pages\paiement.php on line 11
Warning: simplexml_load_file() [function.simplexml-load-file]: PlanningInfos/PlanningInfos.xml:8: parser error : EntityRef: expecting ';' in C:\Program Files\EasyPHP 2.0b1\www\site\php\pages\paiement.php on line 11
Warning: simplexml_load_file() [function.simplexml-load-file]: laces" tarif="620 euros" type="1028" urlParams="page=paiement&type=anglais&categ in C:\Program Files\EasyPHP 2.0b1\www\site\php\pages\paiement.php on line 11
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in C:\Program Files\EasyPHP 2.0b1\www\site\php\pages\paiement.php on line 11
Warning: simplexml_load_file() [function.simplexml-load-file]: PlanningInfos/PlanningInfos.xml:8: parser error : EntityRef: expecting ';' in C:\Program Files\EasyPHP 2.0b1\www\site\php\pages\paiement.php on line 11
Warning: simplexml_load_file() [function.simplexml-load-file]: 20 euros" type="1028" urlParams="page=paiement&type=anglais&categ=anglais1&stage in C:\Program Files\EasyPHP 2.0b1\www\site\php\pages\paiement.php on line 11
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in C:\Program Files\EasyPHP 2.0b1\www\site\php\pages\paiement.php on line 11 |
J'ai compris qu'il s'agit du caractère & qui n'est pas accepté.
Pouvez-vous m'aider ?
merci.