Trying to access the 3rd element within an XML file using PHP : <itms:coverArt height="100" width="100">, any suggestions? Sample XML code: <itms:album>Monkey Business</itms:album> <itms:albumPrice>$9.99</itms:albumPrice> <itms:coverArt height="53" width="53">http://a1.phobos.apple.com/Music/y2005/m05/d26/h21/s06.mwomqcas.53x53-75.jpg</itms:coverArt> <itms:coverArt height="60" width="60">http://a1.phobos.apple.com/Music/y2005/m05/d26/h21/s06.mwomqcas.60x60-75.jpg</itms:coverArt> <itms:coverArt height="100" width="100">http://a1.phobos.apple.com/Music/y2005/m05/d26/h21/s06.mwomqcas.100x100-99.jpg</itms:coverArt> <itms:song>My Humps</itms:song> Code (markup): able to place other items into array no problem , but how do you differentiate between the 3 different itms:coverArt items Thanks!!!
Do you know you want the third because it's the third, or because it has height and width attributes of 100? If you know the position will be the same, once you have the items in the array, then just reference element 2 (the third one). If you know what the attributes are then you'll need to loop the items and check the attributes. That's about as specific as I can get since you didn't include any PHP code.
thanks for the insight ... want the 3rd for the height & width of 100 I am tweaking 'lastRSS' :: http://lastrss.webdot.cz/ here's a sample: if ($this->stripHTML && $result['items'][$i]['itms:coverArt']) $result['items'][$i]['itms:coverArt'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['itms:coverArt']))); Code (markup):