- simplexml_load_string: documentation ( source)
<?php
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<book>
<section>
<p>Example text</p>
<p>Another text</p>
<img l:href="imagehref">
<p>Textual content</p>
</section>
</book>';
$xml = simplexml_load_string($xml);
foreach($node->xpath('/section') as $section) {
echo 'Got section', "\n";
}