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_simple1.php 159882 2004-05-28 16:09:48Z 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 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
?>