[ Index ] |
|
Code source de PHP PEAR 1.4.5 |
1 <?PHP 2 /** 3 * example for XML_Parser_Simple 4 * 5 * $Id: xml_parser_simple1.php,v 1.3 2004/05/28 16:09:48 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 myParser extends XML_Parser_Simple 18 { 19 function myParser() 20 { 21 $this->XML_Parser_Simple(); 22 } 23 24 /** 25 * handle the element 26 * 27 * The element will be handled, once it's closed 28 * 29 * @access private 30 * @param string name of the element 31 * @param array attributes of the element 32 * @param string character data of the element 33 */ 34 function handleElement($name, $attribs, $data) 35 { 36 printf('handling %s in tag depth %d<br />', $name, $this->getCurrentDepth()); 37 printf('character data: %s<br />', $data ); 38 print 'Attributes:<br />'; 39 print '<pre>'; 40 print_r( $attribs ); 41 print '</pre>'; 42 print '<br />'; 43 } 44 } 45 46 $p = &new myParser(); 47 48 $result = $p->setInputFile('xml_parser_simple1.xml'); 49 $result = $p->parse(); 50 ?>
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 |