chelnov63 Posted September 22, 2009 Share Posted September 22, 2009 hi everyone my XML is like: <?xml version="1.0" encoding="ISO-8859-1"?> <feed> <mazda> <car id="ty001"> <config id="manufacturer"><![CDATA[mazda]></config> <config id="model"><![CDATA[Vanquish]]></config> <config id="spec"><![CDATA[5dr 1.33 MT]]></config> <!-- start new fields --> <config id="doors"><![CDATA[5dr]]></config> <config id="engine"><![CDATA[1.33]]></config> <config id="trim"><![CDATA[MT]]></config> <config id="purchase"><![CDATA[9372]]></config> <!-- end new fields --> <config id="mpg"><![CDATA[52.3]]></config> <config id="fueltype"><![CDATA[Petrol]]></config> <config id="co2"><![CDATA[127]]></config> <config id="bik20"><![CDATA[15]]></config> <config id="bik40"><![CDATA[15]]></config> <config id="bhp"><![CDATA[135]]></config> <config id="vedpre"><![CDATA[100]]></config> <config id="vedpost"><![CDATA[100]]></config> <config id="residual"><![CDATA[6340]]></config> </car> </mazda> </feed> and a snippet of my javascript trying after loading the XML is as: function stateChanged() { if (xmlhttp.readyState==4) { if (xmlhttp.status==200) { xmlDoc = xmlhttp.responseXML.documentElement; var mazda = xmlDoc.getElementsByTagName("mazda")[0]; var mazda_model = mazda.*.(@type == "model"); alert(mazda_model); // THIS JUST SHOWS BLANK } else { alert("Problem retrieving XML data:" + xmlhttp.statusText); } } } alert(mazda_model); // THIS JUST SHOWS BLANK am i missing something - how do i grab the value of manufacturer? Thanks in advance for your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.