|
Server : Apache System : Linux s1230 5.15.0-139-generic #149~20.04.1 SMP Tue Jul 14 11:21:49 UTC 2026 x86_64 User : p141464 ( 418825) PHP Version : 7.4.33.12 Disable Function : NONE Directory : /home/www/p141464/usr/local/pear/doc/XML_Parser/examples/ |
Upload File : |
<?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";
}
?>