![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /proc/1544360/cwd/usr/share/doc/cpanel-php83-xml-parser/examples/ |
<?PHP /** * Example for the func-mode * * @author Stephan Schmidt <[email protected]> * @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"; } ?>