DOMExceptions not thrown when I expect them to

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rutger Claes

    DOMExceptions not thrown when I expect them to

    When I execute the folowing in PHP5

    <?php
     $xml = <<<XML
    <page>
     <test>Dit is een test<test>
    </page>
    XML;
     
     $dom = new DomDocument();
     try { 
      $dom->loadXML( $xml );
     } catch( DOMException $e ) { 
      print $e; 
     }
    ?>

    I only get error messages, no DOMExceptions. The documentation of the DOM
    package on Zend says:
    The API of the module follows the DOM Level 2 standard as closely as
    possible. Consequently, the API is fully object-oriented. It is a good idea
    to have the DOM standard available when using this module.

    Followed by a list of possible DOMExceptions and their codes.

    My question is, how can I detect XML errors in the document loaded by
    $dom->load() without using the PHP error reporting ( set_error_handl er(),
    set_error_level (), trigger_error() ... )

    Thanks in advance
     Rutger
    --
    Rutger Claes rutger.claes@ti scali.tld
    Replace tld with top level domain of belgium to contact me pgp:0x3B7D6BD6
    In the next world, you're on your own.
Working...