xml parsin
Ok, can someone point me in the right direction in parsing an xml document? What I am looking for is what is inside 'elements' and 'node'.. the docs are really thin here.
3 Answers
-
I used the Kitchen sink examples on how to parse xml etc etc. xhr_xml.js and xml_rss,js helped alot.
-
Hi Clint,
A tiny example. I have xml returned that is a list of "measurement" objects. Each measurement has an "id" attribute.
xhr.onload = function() { var xml = this.responseXML; var measurementList = xml.documentElement.getElementsByTagName("measurement"); for (var c=0;c < measurementList.length;c++) { var id_text = measurementList.item(c).getElementsByTagName("id").item(0).text; } };
Hope it's useful.
Bruce
-
Thanks guys. I didn't see the rss example in the KS, but after looking at that, I have it working now. Now I remember why I hate working with XML, such a pain…