PHP code example of tmitry / xmlreader-extension

1. Go to this page and download the library: Download tmitry/xmlreader-extension library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tmitry / xmlreader-extension example snippets


use tmitry\XMLReaderExtension\XMLParser;

$xmlReader = new XMLReader();
$xmlReader->open($fileName);
// ... some actions with instance of XMLReader
$parser = new XMLParser($xmlReader);

$parser = new XMLParser();
$parser->open($fileName);

// extended interface
if ($parser->moveTo('root/products') && $parser->moveIn()) {
    do {
        if ('root/products/product' == $parser->getPath()) {
            // standart XMLReader interface
            echo $parser->readOuterXml();
        }
    } while ($parser->moveToNextSibling());
}