GetElementById dom xml php
Bonjour,
j'ai un problème avec le getElementById,voici la partie de mon code qui pose problème
$dom = new DomDocument();
$dom->load('fichier.xml');
$racine =$dom->documentElement;
$neoud=$racine->appendChild($dom->createElement("graph","5"));
$noeud->setAttribute("gid","2008");
$noeud->setIdAttribute("gid",true);
$id = $dom->getElementById("gid");
$dom->save('fichier_test.xml');
quand je veux tester $id,ben c'est quoi qu'il arrive null(ou vide),bref,pourtant dans mon fichier xml de sortie tout se génere parfaitement.
pourriez vous m'eclairer?
Merci d'avance!
j'ai un problème avec le getElementById,voici la partie de mon code qui pose problème
$dom = new DomDocument();
$dom->load('fichier.xml');
$racine =$dom->documentElement;
$neoud=$racine->appendChild($dom->createElement("graph","5"));
$noeud->setAttribute("gid","2008");
$noeud->setIdAttribute("gid",true);
$id = $dom->getElementById("gid");
$dom->save('fichier_test.xml');
quand je veux tester $id,ben c'est quoi qu'il arrive null(ou vide),bref,pourtant dans mon fichier xml de sortie tout se génere parfaitement.
pourriez vous m'eclairer?
Merci d'avance!