Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
convert_fonz_for_import.php
1 <?php
26 if ($argc != 2) {
27  echo "Usage: php convert_fonz_for_import inputfile.txt > outputfile.xml \n";
28  exit();
29 }
30 ?>
31 <thesaurus>
32 <?php
33 $handle = fopen($argv[1], 'r');
34 while ((list($parent_term, $relation_name, $child_term) = fgetcsv($handle, 1000, ',', '"')) !== FALSE) {
35  // do not include definitions or scope notes because they are paragraphs
36  if (($relation_name != 'Definition') && ($relation_name != 'Scope Note')) {
37  echo '<term name="'.$parent_term.'">'."\n";
38  echo '<relation name="'.$relation_name.'">'."\n";
39  echo '<term name="'.$child_term.'"/>'."\n";
40  echo '</relation>'."\n";
41  echo '</term>'."\n";
42  }
43 }
44 fclose($handle);
45 ?>
46 </terms>
47 </thesaurus>