Hi Guys,
I have a XML string which i get from the form post variable. I get the xmlstring and want to parse. I get the xml well and properly. I dont have any problem in getting the XML string, but how can i get the attributes of the nodes. I'm not able to get the attributes. Please help me what am i doing wrong.
My XML string is below:
<RANK>
<DATA>
<STANDARD MARK="100" ID="A1"></STANDARD>
<OPINION RATE="34" CAT="01"></OPINION>
</DATA>
</RANK>
Now my PHP code is below
$xmlstring=$_POST["xmltxt"]; // this is the XML string which i get
$xml = simplexml_load_string($xmlstring);
foreach ($xml->children() as $child) {
foreach($child->attributes("id") as $a => $b){
echo($a." = ".$b);
}
}
This is my code, but still no output. WHat is wrong why am i not able to get the attributes.
PLEASE HELP!!!
Bye