[DOM] Ajout d'élément à un fichier XML
Salut a tous ! voila c la première fois que j'utilise PHP pour écrire dans un fichier XML et je rencontre quelques erreurs !
voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
$filename = '../Clips.xml';
$dom = new DomDocument();
$dom->formatOutput = TRUE;
$dom->preserveWhiteSpace = FALSE;
$dom->load($filename);
$news = $dom->createElement('Clip');
$news->setAttribute('Chemin', $chemin);
$news->setAttribute('Titre',$_POST['titre_video']);
$dom->documentElement->appendChild($news);
$dom->save($filename); |
et les erreus
Citation:
video uploadée avec succès !
Warning: DOMDocument::load() [function.DOMDocument-load]: Unsupported encoding UFT-8 in file:///D%3A/%23%23%23PERSO%23%23%23/site%20perso/www/Clips.xml, line: 1 in D:\###PERSO###\site perso\www\administration\inc\ajout_video.inc.php on line 55
Fatal error: Call to a member function appendChild() on a non-object in D:\###PERSO###\site perso\www\administration\inc\ajout_video.inc.php on line 59
Merci d'avance pour votre aide !!!