1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
$fxml='reference.xml';
$dir='files';
$nb_depots=2;
for ($i=0 ; $i<$nb_depots; $i++)
{
$dom = new DomDocument();
$dom->load($fxml);
if ($dom->validate()) {
echo "Ce document est valide !\n";
}
$Node = $dom->getElementsByTagName('Identification')->item(0);
$Num = str_pad ($i, 6, '0', STR_PAD_LEFT);
$Node->setAttribute("NoDepot", $Num);
$dom->save($dir.'/'."apdgaaaa.03$Num.xml");
$zip = new ZipArchive();
if ($zip->open("apdgaaaa.03$Num", ZipArchive::CREATE) === TRUE) {
$zip->addFile($dir.'/'."apdgaaaa.03$Num.xml");
$zip->close();
echo 'ok';
} else {
echo 'échec';
}
} |
Partager