| 12
 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
 
 |  
$isSheet = false;
  $numSheets = 0;
  $id = 0;
 
  $parser = xml_parser_create();
  xml_set_element_handler($parser, "beginElement", "endElement");
  xml_set_character_data_handler($parser, "charData");
  xml_parse($parser, $xml);
  xml_parser_free($parser);
 
  function beginElement($xmlparser, $nom, $attr) {
  	global $isSheet, $numSheets, $id;
 
  	if ($nom == "project-name") {
  		if (sizeof($attr)>0) {
  			$id = $attr["id"];
  		}
  		$isSheet = true;
  		$numSheets++;
  	}
  }
 
  function endElement($xmlparser, $nom) {
  	// il ne faut rien faire ici dans ce cas.
  }
 
  function charData($xmlparser, $text) {
  	global $isSheet, $id;
  	if ($isSheet) {
  	  echo "<tr>";
  	  echo "<td width='70%'><a href='show.php?id=".$id."'>".$text."</a></td>";
  	  echo "<td><a href='modify.php?id=".$id."'>Modify</a> <a href='delete.php?id=".$id."'>Delete</a></td>";
  	  echo "</tr>";
  	  $isSheet = false;
        }
  } |