I need to parse a simple XML file but somehow I get tonnes of errors.
Firstly, I tried to use "domxml_open_file()" but it ends up in an error:

Call to undefined function domxml_open_file()

(I have set up the domxml properly. phpinfo shows that dom is activated. and I have copied the necessary dll files in my system32 folder.

Then I tried to use "simplexml_load_file()". Following is my code:

$xml = simplexml_load_file('profiles.xml');

var_dump($xml);

echo count($xml);
for($x=0;$x<count($xml);$x++)
echo $xml[$x] . '<br>';

My profiles.xml file is as follows:

<?xml version="1.0" ?>
<selectedProfiles>
<user id="user01">
<profile id="0001" />
<profile id="0002" />
<profile id="0003" />
</user>
<user id="user05">
<profile id="0006" />
<profile id="0008" />
</user>
</selectedProfiles>

It displays the output as:

object(SimpleXMLElement)#4 (1) { ["user"]=> array(2) { [0]=> object(SimpleXMLElement)#1 (1) { ["profile"]=> array(3) { [0]=> object(SimpleXMLElement)#2 (0) { } [1]=> object(SimpleXMLElement)#5 (0) { } [2]=> object(SimpleXMLElement)#7 (0) { } } } [1]=> object(SimpleXMLElement)#3 (1) { ["profile"]=> array(2) { [0]=> object(SimpleXMLElement)#8 (0) { } [1]=> object(SimpleXMLElement)#9 (0) { } } } } } 1

I dont know how to obtain the individual array elements.

Can anyone please help me on how to get the selected profiles for each user?
Any code will definitely help. Also please tell me as to how do I get the domxml_open_file() method working.

Thanks in advance.
Hemal