Reads XML from either a string or a stream, allowing the registration of callbacks when an elemnt is found that matches path.
- Install Zephir
zephir build
- Add
extension=streamparser
to yourphp.ini
<?php
declare(strict_types = 1);
$handle = \fopen(__DIR__ . 'games.xml', 'rb');
(new SixDreams\StreamReader\XmlStreamReader())
->registerCallback('/root/sport', '/root/sport/groups/group/events/event', function (string $rawXml) {
echo 'XML: ' . $rawXml . "\n";
})
->parse($handle);
\fclose($handle);
@todo...