XML Parse
Trying to work through parsing the following XML return:
<resultset count="3" pstate="CA" resultType="campgrounds" waterfront="3011">
<result availabilityStatus="N" contractID="NRSO" contractType="FEDERAL" facilityID="73968" facilityName="HARVEY WEST CABIN (CA)" faciltyPhoto="/photos/details/nrso_73968_1.jpg" latitude="38.755" longitude="-120.275" sitesWithAmps="N" sitesWithPetsAllowed="N" sitesWithSewerHookup="Y" sitesWithWaterHookup="N" sitesWithWaterfront="Lakefront" state="CA"/>
<result availabilityStatus="N" contractID="NRSO" contractType="FEDERAL" facilityID="70941" facilityName="LODGEPOLE SEQUOIA NATIONAL PARK CA" faciltyPhoto="/photos/details/nrso_70941_1.jpg" latitude="36.5013889" longitude="-118.6263889" sitesWithAmps="N" sitesWithPetsAllowed="Y" sitesWithSewerHookup="Y" sitesWithWaterHookup="N" sitesWithWaterfront="Riverfront" state="CA"/>
<result availabilityStatus="N" contractID="ELS2" contractType="PRIVATE" facilityID="260861" facilityName="Wilderness Lakes Campground" faciltyPhoto="/photos/details/els2_260861_1.jpg" latitude="33.6741667" longitude="-117.1366667" sitesWithAmps="Y" sitesWithPetsAllowed="N" sitesWithSewerHookup="Y" sitesWithWaterHookup="Y" sitesWithWaterfront="Springs" state="CA"/>
</resultset>
With the following lines:
xhr.onload = function()
{
Ti.API.info('Active xml ' + this.responseXML + ' text ' + this.responseText);
var doc = this.responseXML.documentElement;
var result = doc.getElementsByTagName("result");
Ti.API.info("facility = " + result[0].getAttribute("facilityName"));
};
However the return on TI Info is "facility = null". Thoughts on what I am doing wrong to grab the facility name attribute?