<?php
/**
 * Created by PhpStorm.
 */

$doc = new DOMDocument();
$doc->load('book.xml');
$nodes = $doc->getElementsByTagName('para');

foreach ($nodes as $node)
{
    echo $node->nodeValue;
    echo "<br>";
}

$nodes = $doc->getElementsByTagName('prod');
echo $nodes->item(0)->getAttribute('media');