PHP code example of elecena / xml-iterator

1. Go to this page and download the library: Download elecena/xml-iterator 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/ */

    

elecena / xml-iterator example snippets


use Elecena\XmlIterator\XMLParser;
use Elecena\XmlIterator\Nodes\XMLNodeOpen;
use Elecena\XmlIterator\Nodes\XMLNodeContent;

stanceof XMLNodeContent && $node->name === 'loc') {
		echo "Sub-sitemap found: {$node->content}\n";
    }
	elseif ($node instanceof XMLNodeOpen && $node->name === 'sitemapindex') {
		echo "Sitemap index node found, attributes: " . print_r($node->attributes, return: true) . "\n";
	}
}

fclose($stream);