Good question, it's on my list of stuff to find out too.
You have the right idea with xpath, I know you can do it in IE but a cross-browser solution I don't think exists. I created a new thread asking that specifically...
http://www.sitepoint.com/forums/showthread.php?t=460735
PS, in IE you can do this:
Code:
var ajax = new ActiveXObject("msxml.xmlhttp");
// code to execute ajax request and return xml goes here
var dom = ajax.responseXML;
// use xpath to get the location record where city=ALISO VIEJO
var record = dom.selectSingleNode("records/record[city='ALISO VIEJO']");
// get the phone number element for record with zip=91301
var record = dom.selectSingleNode("records/record[zip='91301']/phone");
// use xpath to get ALL RECORDS with state = ca
var records = dom.selectNodes("records/record[state='ca']");
hope that helps
Bookmarks