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 the func-mode
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 '../Parser.php';
14
 
15
class myParser extends XML_Parser
16
{
17
    function xmltag_foo_bar($xp, $name, $attribs)
18
    {
19
        print "handle start foo-bar\n";
20
    }
21
 
22
    function xmltag_foo_bar_($xp, $name)
23
    {
24
        print "handle end foo-bar\n";
25
    }
26
 
27
    function xmltag_foo($xp, $name)
28
    {
29
        print "handle start foo\n";
30
    }
31
 
32
    function xmltag_foo_($xp, $name)
33
    {
34
        print "handle end foo\n";
35
    }
36
}
37
 
38
$p = &new myParser(null, 'func');
39
 
40
$result = $p->setInputString('<foo><foo-bar/></foo>');
41
if (PEAR::isError($result)) {
42
    print $result->getMessage() . "\n";
43
}
44
$result = $p->parse();
45
if (PEAR::isError($result)) {
46
    print $result->getMessage() . "\n";
47
}
48
?>