/usr/share/php/doc/XML_Parser/examples/xml_parser_funcmode.php is in php-xml-parser 1.3.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | <?PHP
/**
* Example for the func-mode
*
* @author Stephan Schmidt <schst@php-tools.net>
* @package XML_Parser
* @subpackage Examples
*/
/**
* require the parser
*/
require_once '../Parser.php';
class myParser extends XML_Parser
{
function xmltag_foo_bar($xp, $name, $attribs)
{
print "handle start foo-bar\n";
}
function xmltag_foo_bar_($xp, $name)
{
print "handle end foo-bar\n";
}
function xmltag_foo($xp, $name)
{
print "handle start foo\n";
}
function xmltag_foo_($xp, $name)
{
print "handle end foo\n";
}
}
$p = &new myParser(null, 'func');
$result = $p->setInputString('<foo><foo-bar/></foo>');
if (PEAR::isError($result)) {
print $result->getMessage() . "\n";
}
$result = $p->parse();
if (PEAR::isError($result)) {
print $result->getMessage() . "\n";
}
?>
|