Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

October 22, 2010


Parse/Get XML attribute using PHP SimpleXMLElement

Today i write something about xml parsing using PHP. I am taking xml file contents using file_get_contents function. Now parsing file contents by creating object of SimpleXMLElement. I can easily get all elements of xml using $xml->name or if it is an array than $xml->name[0]->fname. But the problem is with attributes. I have one array which have attributes. Below is the simple way to get/parse xml attributes.