load($infoName); $dimensions = $info->getElementsByTagName("dimensions")->item(0); $dim_1 = $dimensions->getAttribute("dim_1"); $dim_2 = null; if ($dimensions->hasAttribute("dim_2")) $dim_2 = $dimensions->getAttribute("dim_2"); $tables = $info->getElementsByTagName("table"); foreach ($tables as $table) { $channels = $table->getElementsByTagName("channel"); $dim = $table->getAttribute("relatedDim"); if ( $dim == "dim_1" ) $dim_ = $dim_1; if ( $dim == "dim_2" ) $dim_ = $dim_2; if ($dim_ != $channels->length) { $dimensions->setAttribute($dim, $channels->length); echo $infoName.PHP_EOL; echo $dim_." ".$channels->length.PHP_EOL; } } $info->save($infoName); } ?>