I am trying to mine an xml doc with javascript, looping through the parent nodes and then looping through the children within those nodes to output the values. I am getting the child values for the first parent but then it exits the first loop so I only get one recordset. Playing around with the curly braces allows me to get the last record but not the first. The short story is that I'm getting only one record. Any help will be welcome.
function display(recordSet)
{
var output
var menu = recordSet.documentElement.nodeName;
var length = recordSet.childNodes(1).childNodes.length; // obtains recordset count
output = "<h1><center>" + menu + length + "</center></h1><br><br>"
for(i=0;i<length;i++){
var node = recordSet.documentElement.childNodes(i)
var nodeLength = node.childNodes.length// number of product attributes
output += "<h3>" + node.nodeName + "</h3><br><br>"
for(i=0;i<nodeLength;i++){ // loop the product attributes
var attributeName = node.childNodes(i).nodeName // attribute name
var attributeValue = node.childNodes(i).firstChild.nodeValue // attribute value
if (attributeName=="pic")
output +="<img src='http://www.webdeveloper.com/forum/archive/index.php/" + attributeValue + "'><br><br>"
else
output += attributeValue + "<br><br>"
}
}
return output
}
function display(recordSet)
{
var output
var menu = recordSet.documentElement.nodeName;
var length = recordSet.childNodes(1).childNodes.length; // obtains recordset count
output = "<h1><center>" + menu + length + "</center></h1><br><br>"
for(i=0;i<length;i++){
var node = recordSet.documentElement.childNodes(i)
var nodeLength = node.childNodes.length// number of product attributes
output += "<h3>" + node.nodeName + "</h3><br><br>"
for(i=0;i<nodeLength;i++){ // loop the product attributes
var attributeName = node.childNodes(i).nodeName // attribute name
var attributeValue = node.childNodes(i).firstChild.nodeValue // attribute value
if (attributeName=="pic")
output +="<img src='http://www.webdeveloper.com/forum/archive/index.php/" + attributeValue + "'><br><br>"
else
output += attributeValue + "<br><br>"
}
}
return output
}