| Server IP : 217.160.0.251 / Your IP : 216.73.216.102 Web Server : Apache System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux User : u94981163 ( 8991765) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/lib/php7.3/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";
}
?>