var data = "Python C++ "+
"Java ";
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(data,'text/xml');alert(xmlDoc.getElementsByTagName('lang')[0].
childNodes[0].nodeValue;); // Python
alert(xmlDoc.getElementsByTagName('lang')[1].
childNodes[0].nodeValue;); // C++
alert(xmlDoc.getElementsByTagName('lang')[2].
childNodes[0].nodeValue;); // Java
No comments:
Post a Comment