1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| $sxe = new SimpleXMLElement('<?xml version="1.0" encoding="ISO-8859-1"?><cartes></cartes>');
foreach ($donnees as $don){
$carte = $sxe->addChild('carte');
$carte->addChild('myFere', $don[0]);
$carte->addChild('affectation', $don[1]);
$carte->addChild('motif', $don[2]);
$carte->addChild('dateDemande', $don[3]);
$carte->addChild('utilisateur', $don[4]);
}
// echo $sxe->asXML();break;
$inter = $sxe->asXML();
$dom = new DomDocument;
$dom->preserveWhiteSpace = FALSE;
$dom->loadXML($inter);
$dom->formatOutput = true;
file_put_contents("../publish/generated/listenoire.xml",$dom->saveXML()); |