I am reciving an xml data like the example below from a remote api. Could any one show me how i can get the key names and its corresponding key values and print them?For example i want to print all categoryIcon and category values.Thanks
javascript :
xml to parse:
javascript :
Code:
$.get("[URL unfurl="true"]http://www.someapisite.com/test.php",[/URL]
{
dataType: "jsonp"
},
function(data,status){
//here i want to print the key names and its corresponding values
}
xml to parse:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<dict><key>ItemLists</key>
<array><dict><key>id</key>
<string>1</string>
<key>name</key>
<string>fruits</string>
<key>category</key>
<string>US Fruits</string>
<key>categoryIcon</key>
<string>[URL unfurl="true"]http://www.somsite.com/categories/1.jpg</string>[/URL]
<key>country</key>
<string>US</string>
</dict>
<dict><key>id</key>
<string>2</string>
<key>name</key>
<string>Vegetable</string>
<key>category</key>
<string>Eu Vegetable</string>
<key>categoryIcon</key>
<string>[URL unfurl="true"]http://www.somsite.com/categories/2.jpg</string>[/URL]
<key>country</key>
<string>EU</string>
</dict>
</array>
</dict>