Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > 0ded781dd426e5bcc186e6a6b4f181d3 > files > 5

php-pear-XML_Parser2-0.1.0-4.mga5.noarch.rpm

<?PHP
/**
 * Example for the func-mode
 *
 * @author      Stephan Schmidt <schst@php-tools.net>
 * @package     XML_Parser2
 * @subpackage  Examples
 */

/**
 * require the parser
 */
require_once 'XML/Parser2.php';

class myParser extends XML_Parser2
{
    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>');
$result = $p->parse();
?>