return false; } function isComment($line) { if (preg_match("#<\\?([^/]*)\\?>#i", $line)) { return true; } return false; } $fd = fopen($plan, 'r'); //PARSING XML while (!feof($fd)) { $line = fgets($fd); if (match_partie($line, $partie)) { $line = fgets($fd); while (is_note($line)) { array_push($notes, extract_note($line)); $line = fgets($fd); } } } //FUSION $titre = 'compilation_' . $notes[0]; $fdc = fopen('xml/note/' . $titre . '.xml', 'w'); $cpt = 0; fputs($fdc, "<note uri=\"uri_note_" . $titre . "\">\n"); foreach ($notes as $file) { $fd = fopen('xml/note/' . $file . '.xml', 'r'); while (!feof($fd)) { $line1 = fgets($fd); if ($cpt == 0) {
$fd = fopen($plan, 'r'); //PARSING XML $i = -1; while (!feof($fd)) { // $line = fgets($fd); // if(match_partie($line,$partie)) // { $line = fgets($fd); //echo "ligne lue".$line."<br>"; if (is_partie($line)) { //array_push($parties,extract_titre_partie($line)); $notes = array(); $i++; $parties[$i]['titre'] = extract_titre_partie($line); //echo "titre récupéré".extract_titre_partie($line)."<br>"; } elseif (is_note($line)) { array_push($notes, extract_note($line)); $parties[$i]['notes'] = $notes; //echo "note récupérée".extract_note($line)."<br>"; } // } } //FUSION $titre = 'compilation'; $fdc = fopen('xml/note/' . $titre . '.note', 'w'); $cpt = 0; fputs($fdc, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\r\n\t\t\t<?xml-stylesheet type=\"text/css\" href=\"style.css\" media=\"all\"?>\n\r\n\t\t\t<note uri=\"uri_note_" . $titre . "\">\n"); foreach ($parties as $partie) { fputs($fdc, "<partie>"); fputs($fdc, "<titrepartie>" . $partie['titre'] . "</titrepartie>"); // echo "<pre>";
} function match_tag($tag, $line) { if (preg_match("#</?{$tag}([^/]*)>(([^/]+)</{$tag}>)?#i", $line)) { return true; } return false; } $fd = fopen($article, 'r'); $titre = 'compilation'; $fdc = fopen('xml/article/' . $titre . '.xml', 'w'); //PARSING XML $i = 0; while (!feof($fd)) { $line = fgets($fd); if (is_note($line)) { $note = extract_note($line); $notes[$i] = $note; $i++; /*$temoin=extract_note($line); array_push($note,$temoin) /*echo "Hello Maxime la réponse est là" . $temoin; fputs($fdc,$line);*/ } elseif (is_article($line)) { fputs($fdc, "<?xml-stylesheet type=\"text/css\" href=\"style.css\" media=\"all\"?>\n<article>\n"); } elseif (is_article_end($line)) { } else { fputs($fdc, $line); } } //FUSION