[ Index ] |
|
Code source de PHP PEAR 1.4.5 |
1 <?PHP 2 /** 3 * example for XML_Parser_Simple 4 * 5 * $Id: xml_parser_simple_handler.php,v 1.1 2004/05/25 13:26:42 schst Exp $ 6 * 7 * @author Stephan Schmidt <schst@php-tools.net> 8 * @package XML_Parser 9 * @subpackage Examples 10 */ 11 12 /** 13 * require the parser 14 */ 15 require_once 'XML/Parser/Simple.php'; 16 17 class myHandlerSimple 18 { 19 /** 20 * handle the category element 21 * 22 * The element will be handled, once it's closed 23 * 24 * @access private 25 * @param string name of the element 26 * @param array attributes of the element 27 * @param string character data of the element 28 */ 29 function handleElement_category($name, $attribs, $data) 30 { 31 printf( 'Category is %s<br />', $data ); 32 } 33 34 /** 35 * handle the name element 36 * 37 * The element will be handled, once it's closed 38 * 39 * @access private 40 * @param string name of the element 41 * @param array attributes of the element 42 * @param string character data of the element 43 */ 44 function handleElement_name($name, $attribs, $data) 45 { 46 printf( 'Name is %s<br />', $data ); 47 } 48 } 49 50 $p = &new XML_Parser_Simple(); 51 $h = &new myHandlerSimple(); 52 $p->setHandlerObj($h); 53 $result = $p->setInputFile('xml_parser_simple2.xml'); 54 $p->setMode('func'); 55 $result = $p->parse(); 56 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 14:08:00 2007 | par Balluche grâce à PHPXref 0.7 |