Nouveau petit problème...
J'ai un formulaire qui permet d'ajouter des articles.
Lors de la validation des articles, il sont enregistré dans un objet XML géré avec SimpleXML.
Tout fonctionne jusqu'au moment ou on retrouve des accents, & ou d'autres caractères spéciaux.
Voici les premières erreurs qui s'affichent :
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 2: parser error : xmlParseEntityRef: no name in C:\wamp\www\projet\admin.php on line 96
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: <articles><article prix="12"><nom>& in C:\wamp\www\projet\admin.php on line 96
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in C:\wamp\www\projet\admin.php on line 96
Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 2: parser error : Premature end of data in tag nom line 2 in C:\wamp\www\projet\admin.php on line 96
et la ligne 96 :
$xml = new SimpleXMLElement($_SESSION["articles"]);
j'ai essayé en mettant htmlentities() sur les données du formulaire sans succès.
Voici l'en-tête de mon objet XML : <?xml version="1.0" encoding="iso-8859-1"?>
Si vous pouvez m'aider....
EDIT:
Bon visiblement en protégeant ma variable comme ceci ça fonctionne :