aggiornamento ...

alla fine ho messo in pratica il codice qui discusso. Ecco cosa ho scritto

Codice PHP:
// validation against DTD using DOM extension
   
function validate($f) {
      
$dtd "xml/mtDTD.dtd";
      
$dom = new DOMDocument;
      
$dom->Load($f);
      return (
$dom->validate()) ? true false;
   }

   
set_error_handler(create_function('''throw new Exception("errore php");'));   
  
   try {
      
// create the resource URL
      
$file "xml/" $_GET["id"] . ".xml";
      
      
// print a shitload of errors if the xml file is not DTD compliant
      
validate($file);
      
      
// load DOM tree with simpleXML
      
$doc simplexml_load_file($file);
      
      
// set to encoding to utf-8
      
header('Content-type: text/html; charset=utf-8');
   }
   catch (
Exception $e) {
      echo 
$e->getMessage(); 
   } 
se prova a creare volontariamente un errore (tipo passo un id che non esiste) mi becco questo errore:

codice:
errore php
Fatal error: Uncaught exception 'Exception' with message 'errore php' in C:\apache\htdocs\www\test\page.php(11) : runtime-created function:1 Stack trace: #0 C:\apache\htdocs\www\test\page.php(36): __lambda_func(8, 'Undefined varia...', 'C:\apache\htdoc...', 36, Array) #1 {main} thrown in C:\apache\htdocs\www\test\page.php(11) : runtime-created function on line 1
mentre io mi aspettavo solo:

codice:
errore php
forse perche il try solleva piu di una eccezzione? booooh!

grazie