I have a XMLHTTPResponse function like this which receives the returning XML and extracts the information for processing:
PHP Code:
function handleServerResponse()
{
// move forward only if the transaction has completed
if (xmlHttp.readyState == 4)
{
// status of 200 indicates the transaction completed successfully
if (xmlHttp.status == 200)
{
// extract the XML retrieved from the server
xmlResponse = xmlHttp.responseXML;
// obtain the document element (the root element) of the XML structure
xmlDocumentElement = xmlResponse.documentElement;
// get the text message, which is in the first child of
// the the document element
var product_node=xmlDocumentElement.firstChild;
//var product_id = product_node.pr_id;
var pr_name= product_node.firstChild.nodeValue;
var pr_details= product_node.firstChild.nextSibling.nodeValue;
// update the client display using the data received from the server
document.getElementById("details_box").innerHTML = pr_name + "<p />" + pr_details;
// restart sequence
//setTimeout('process(produ)', 1000);
}
else
{
alert("There was a problem accessing the server: " + xmlHttp.statusText);
}
}
}
It seems to work fine and I can traverse my tree and print out nodeName(s) but not nodeValue(s). What am I doing wrong? My firebug extension is showing me that my XML returned the information fine.
Here is my XML:
PHP Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<products>
<product pr_id="1">
<name>washing machine</name>
<details>hoover washing machine, 3yr warranty etc</details>
</product>
</products>
Nibinaear