コード例 #1
0
         }
     }
     if (isset($statisticalCategory) && $statisticalCategory != "NULL") {
         $USCL = $UR->appendChild($xmlDoc->createElement('user_statistics'));
         // Parent/Child Element
         $UC = $USCL->appendChild($xmlDoc->createElement('user_statistic'));
         // Parent/Child Element
         $UC->appendChild($xmlDoc->createElement("statistic_category", $statisticalCategory));
         $x = $xmlDoc->createAttribute('desc');
         $x->value = $statisticalCategory;
         // Need correct code from Ex Libres
         $UI->appendChild($x);
     }
 }
 // while (($row = fgetcsv($inputFile)) !== FALSE) {
 $xmlString = $xmlDoc->savexml();
 $fileName .= "." . date('m_d_y') . ".xml";
 echo "fileName={$fileName}<br />";
 try {
     if (!fopen($fileName, "w")) {
         throw new Exception("Cannot Create, or Append to, specified file.  Contact programming support!");
     }
     $xmlHandle = fopen($fileName, "w");
 } catch (Exception $e) {
     exitRoutine($e->getMessage(), $output, 'error');
     //echo 'Message: ' .$e->getMessage();
 }
 // catch
 $fwrite = TRUE;
 try {
     setOutputFile($xmlHandle, $xmlString);