Well, since I received no answers, I found an alternative solution.
Using DOM method to access XML file:
// DOMElement->getElementsByTagName() -- Gets elements by tagname
// nodeValue : The value of this node, depending on its type.
// Load XML File. You can use loadXML if you wish to load XML data from a string
$objDOM = new DOMDocument();
$objDOM->load("test.xml"); //make sure path is correct
$note = $objDOM->getElementsByTagName("thumbnail");
// for each note tag, parse the document and get values for
// tasks and details tag.
foreach( $note as $value )
{
$tasks = $value->getElementsByTagName("filename");
$task = $tasks->item(0)->nodeValue;
$details = $value->getElementsByTagName("url");
$detail = $details->item(0)->nodeValue;
echo "$task :: $detail <br>";
}
where test.xml:
<thumbnails>
<thumbnail>
<filename>http://thumb1</filename>
<url>Set 1 URL</url>
<description>Album 1</description>
</thumbnail>
<thumbnail>
<filename>http://thumb2</filename>
<url>Set 2 URL</url>
<description>Album 2</description>
</thumbnail>
<thumbnail>
<filename>http://thumb3</filename>
<url>Set 3 URL</url>
<description>Album 3</description>
</thumbnail>
<thumbnail>
<filename>http://thumb4</filename>
<url>Set 4 URL1</url>
<description>Album 4</description>
</thumbnail>
</thumbnails>
or to get xml attribute:
// example on using the 'getAttribute()' method
$dom=new DOMDocument();
$dom->load('test2.xml');
$headlines=$dom->getElementsByTagName('thumbnail');
foreach($headlines as $headline){
echo 'ID attribute of current node is the following: '.$headline->getAttribute('filename').'<br />';
}
where test2.xml:
<thumbnails>
<thumbnail filename="http://thumb1" url="72157620019981688" description="Cat 1"/>
<thumbnail filename="http://thumb2" url="72157619839911144" description="Cat 2"/>
<thumbnail filename="http://thumb3" url="72157619840761942" description="Cat 3"/>
<thumbnail filename="http://thumb4" url="72157619935624301" description="Cat 4"/>
</thumbnails>