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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
<?php
global $i;
$i=0;
//c'est juste pour que la requête s'effectue qu'une fois enfin j'espère.
While ($i<1){
set_time_limit(0);
$fichier = "hegpAllMeasuresNewChi2.lat.xml";
function fonctionBaliseOuvrante($parseur, $nomBalise) {
global $dBR,$id,$OR,$AF,$stat,$withdemo,$withoutdemo,$chi,$cr,$ei,$demo,$medoc,$a,$b,$c,$d,$e,$f,$x,$m,$w;
$dBR = $nomBalise;}
function fonctionBaliseFermante($parseur, $nomBalise){
global $dBR,$id,$OR,$AF,$stat,$withdemo,$withoutdemo,$chi,$cr,$ei,$demo,$medoc,$m,$x,$w;
$a=0;$b=0;$c=0;$d=0;$e=0;$f=0;
if($dBR=="Extent"){$m=count($dBR=="Object_Ref");}
if($dBR=="UpperCovers"){$w=count($dBR=="Concept_Ref"); }
if($dBR=="Intent"){
$x=count($dBR=="Attribute_Ref");}
While($dBR!="Concept"){
$a+=$cr;
$b+=$AF;
$c+=$OR;
$d.=$ei;
$g=count($ei);
$e.=$medoc;
$h=count($medoc);
$f.=$demo;
$j=count($demo);
}
if($dBR=="Concept"){
//connection au serveur:
$cnx = mysql_connect( "localhost", "root", "" ) ;
//sélection de la base de données:
$db = mysql_select_db( "greg" ) ;
$tabInsert[]="(id, nbextension, extension, nbintei, intei, nbintmed, intmed, nbintdemo, intdemo, nbflatintei, flatintei, nbflatintmed, flatintmed, nbflatintdemo, flatintdemo, nbcover,cover, prrdemo, prssdemo, chi, stab, type, comment, valid, xml) VALUES ('$id','$m','','$g','$h','$e','$j','$f','','','','','','','$w','$OR','$withdemo','$witoutdemo','$chi','$stat','','','','')";
$sql=" INSERT INTO concepts VALUES .implode(','$tabinsert[])"
$requete = mysql_query( $sql, $cnx ) ;
mysql_close($cnx);}
$dBR = "";
}
function fonctionTexte($parseur, $text){
global $dBR,$id,$OR,$AF,$stat,$withdemo,$withoutdemo,$chi,$cr,$a,$b,$c,$ei,$medoc,$demo,$d,$e,$f;
if($dBR=="ID"){$id=$text;}
if($dBR=="Object_Ref"){$OR=$text;}
if($dBR=="Attribute_Ref"){
$AF=$text;
if($AF[0]="1"){$ei=$AF;}
elseif($AF[0]="2"){$medoc=$AF;}
elseif($AF[0]="3"){$demo=$AF;}}
if($dBR=="Statility"){ $stat=$text;}
if($dBR=="PRRWithDemo"){$withdemo=$text;}
if($dBR=="PRRWithoutDemo"){$withoutdemo=$text;}
if($dBR=="Chi2"){$chi=$text;}
if($dBR=="Concept_Ref"){$cr=$text;}
}
$parseurXML = xml_parser_create();
xml_set_element_handler($parseurXML, "fonctionBaliseOuvrante", "fonctionBaliseFermante");
xml_set_character_data_handler($parseurXML, "fonctionTexte");
// Ouverture du fichier
$fp = fopen($fichier, "r");
if (!$fp) die("Impossible d'ouvrir le fichier XML");
while ( $ligneXML = fgets($fp, 100000)){
xml_parse($parseurXML, $ligneXML, feof($fp)) or die("Erreur XML");
}
xml_parser_free($parseurXML);
fclose($fp);
$i=$i+1;
}
?> |
Partager