Так я и сделал, используя XMLReader:
<code><?php
define ('XMLFILE', 'http://ws.audioscrobbler.com/2.0/artist/vasco%20rossi/images.rss');
echo "<pre>";
$items = array ();
$i = 0;
$xmlReader = new XMLReader();
$xmlReader->open(XMLFILE, null, LIBXML_NOBLANKS);
$isParserActive = false;
$simpleNodeTypes = array ("title", "description", "media:title", "link", "author", "pubDate", "guid");
while ($xmlReader->read ())
{
$nodeType = $xmlReader->nodeType;
// Only deal with Beginning/Ending Tags
if ($nodeType != XMLReader::ELEMENT && $nodeType != XMLReader::END_ELEMENT) { continue; }
else if ($xmlReader->name == "item") {
if (($nodeType == XMLReader::END_ELEMENT) && $isParserActive) { $i++; }
$isParserActive = ($nodeType != XMLReader::END_ELEMENT);
}
if (!$isParserActive || $nodeType == XMLReader::END_ELEMENT) { continue; }
$name = $xmlReader->name;
if (in_array ($name, $simpleNodeTypes)) {
// Skip to the text node
$xmlReader->read ();
$items[$i][$name] = $xmlReader->value;
} else if ($name == "media:thumbnail") {
$items[$i]['media:thumbnail'] = array (
"url" => $xmlReader->getAttribute("url"),
"width" => $xmlReader->getAttribute("width"),
"height" => $xmlReader->getAttribute("height"),
"type" => $xmlReader->getAttribute("type")
);
} else if ($name == "media:content") {
$items[$i]['media:content'] = array (
"url" => $xmlReader->getAttribute("url"),
"width" => $xmlReader->getAttribute("width"),
"height" => $xmlReader->getAttribute("height"),
"filesize" => $xmlReader->getAttribute("fileSize"),
"expression" => $xmlReader->getAttribute("expression")
);
}
}
print_r($items);
echo "
";
?>