function xmlSave($xmlfilename) { $dom = new domDocument(); /* $complexe = $dom->appendChild(new DOMElement('complexe')); $reel = $complexe->appendChild(new DOMElement('reel')); $imag = $complexe->appendChild(new DOMElement('imag')); $reel->nodeValue=1; $imag->nodeValue=2; */ $complexe = $dom->CreateElement('complexe'); $dom->appendChild($complexe); $reel = $dom->CreateElement('reel', 1); $imag = $dom->CreateElement('imag', 2); $complexe->appendChild($reel); $complexe->appendChild($imag); // ToDo sérialisation XML print $dom->saveXML(); $dom->save($xmlfilename); }