Hi,
I want to read attributes values from an XML file using an array. Here is the sample script which narrates my problem. Its fetching the values from the first node only and displays the same values twice.
M
22/121980
M
22/121980
Somewhere i am making a mistake in this Loop…can anybody works out where???pls,thanx
var oXML = new XML();
oXML.parseXML("<reportdatas><reportdata gender=“M” dateofbirth=“22/12/1980” address=“XYZ” /><reportdata gender="M"dateofbirth=“12/05/1982"address=“XYZ” /></reportdatas>”);
// Grab attribute names
var a = oXML.firstChild.firstChild.attributes;
// Enumerate name/value pairs
len = oXML.firstChild.childNodes.length
//trace(len)
attValue = [];
for(i=0; i<len; i++){
for(att in a){
attValue* = eval(“a.” + att);
trace(attValue*);
}
}
Ashish