Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?PHP
2
/**
3
 * example for XML_Parser_Simple
4
 *
5
 * $Id: xml_parser_simple2.php 159557 2004-05-24 21:42:33Z schst $
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 myParser2 extends XML_Parser_Simple
18
{
19
    function myParser()
20
    {
21
        $this->XML_Parser_Simple();
22
    }
23
 
24
   /**
25
    * handle the category 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_category($name, $attribs, $data)
35
    {
36
        printf( 'Category is %s<br />', $data );
37
    }
38
 
39
   /**
40
    * handle the name element
41
    *
42
    * The element will be handled, once it's closed
43
    *
44
    * @access   private
45
    * @param    string      name of the element
46
    * @param    array       attributes of the element
47
    * @param    string      character data of the element
48
    */
49
    function handleElement_name($name, $attribs, $data)
50
    {
51
        printf( 'Name is %s<br />', $data );
52
    }
53
}
54
 
55
$p = &new myParser2();
56
$result = $p->setInputFile('xml_parser_simple2.xml');
57
$p->setMode('func');
58
$result = $p->parse();
59
?>