home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / xamp / xampp-win32.exe / xampp / xml_parser_handler.php < prev    next >
Encoding:
PHP Script  |  2004-10-01  |  1.0 KB  |  50 lines

  1. <?PHP
  2. /**
  3.  * example for XML_Parser_Simple
  4.  *
  5.  * @author      Stephan Schmidt <schst@php-tools.net>
  6.  * @package     XML_Parser
  7.  * @subpackage  Examples
  8.  */
  9.  
  10. /**
  11.  * require the parser
  12.  */
  13. require_once 'XML/Parser.php';
  14.  
  15. class myHandler
  16. {
  17.    /**
  18.     * handle start element
  19.     *
  20.     * @access   private
  21.     * @param    resource    xml parser resource
  22.     * @param    string      name of the element
  23.     * @param    array       attributes
  24.     */
  25.     function startHandler($xp, $name, $attribs)
  26.     {
  27.         printf('handle start tag: %s<br />', $name);
  28.     }
  29.  
  30.    /**
  31.     * handle start element
  32.     *
  33.     * @access   private
  34.     * @param    resource    xml parser resource
  35.     * @param    string      name of the element
  36.     * @param    array       attributes
  37.     */
  38.     function endHandler($xp, $name)
  39.     {
  40.         printf('handle end tag: %s<br />', $name);
  41.     }
  42. }
  43.  
  44. $p = &new XML_Parser();
  45. $h = &new myHandler();
  46.  
  47. $result = $p->setInputFile('xml_parser_file.xml');
  48. $result = $p->setHandlerObj($h);
  49. $result = $p->parse();
  50. ?>