0

Retrieving values from XML

Hope someone can help me out. I am new to this and I'm trying to access values in my xml feed (json not available at the moment).

my xml looks like this:

<home>
<profile>
<place value="kitchen">
</profile>
</home>

I am trying to retrieve the value "kitchen"

Here is what I have tried, i think I'm close but when this prints out in the terminal i get:
==========city = [object DOMNodeList]

Hopefully someone can point me in the right direction.

CODEBOX
var request = new XMLHttpRequest();
request.onreadystatechange = myStatusProc;
request.open("GET", "myXML.xml", true);
request.send();

// someplace else
function myStatusProc(){
if (this.readyState == 4) {
// complete
var xml = request.responseXML;
var tos = XMLDOM.parse(xml);
var myVal = tos.evaluate('//profile/place@value');
print("***********" + this.status + "****************");
print("==========city = " + myVal);
}
}

by
1 Reply
  • try changing:
    var myVal = tos.evaluate('//profile/place@value');
    to
    var myVal = tos.evaluate('home/profile/place');
    0

Recent Posts

in Design / Interaction - Yahoo! TV Widgets