I am pretty new working with XML files and know that I probably have the terminology wrong for what I am trying to get.
Here's what I need, I am trying to get some information out of a returned XML file attribute but can't seem to make it work, specifically the value of ns1:href in each view element.
XML FILE
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns3:MediaGallery xmlns:ns1="http://www.w3.org/1999/xlink" xmlns:ns3="urn:media.services.chrome.com">
<view backgroundDescription="Transparent" shotCode="02" height="240" width="320" ns1:type="resource" ns1:href="http://media.carbook.com/MediaGallery/media/MjkyNzU4Xk1lZGlhIEdhbGxlcnk/cl7mfC4mn7ScF7PMs7UmWf4ugY-UxsNwkkEiGHPXygftzkCsGogn9A/2011CAD001a_320_02.png"/>
</ns3:MediaGallery>
Now, I have been able to loop through and get the attributes backgroundDescription, shotCode, height, width etc but the one I need is the ns1:href value.
How can I do this ? It's driving me nuts and I have not been able to find the answers online. Any help on this, plus a good resource to learn from would be greatly appreciated.
Thank you.
bah! Still don't understand it but it seems that this worked.
$xml = new SimpleXMLElement($xml);
foreach ($xml as $img)
{
$attr = $img->attributes('ns1', true);
echo $attr['href'];
echo "<p>";
}
Anyone have a good resource where I can learn more about XML files in general?