JSFiddle - React, Tailwind, and code Playground
JavaScript
function xml2dom(xml){
var dom;
if (window.DOMParser){
var parser=new DOMParser();
dom=parser.parseFromString(xml,"text/xml");
}else { // IE
dom=new ActiveXObject("Microsoft.XMLDOM");
dom.async="false";
dom.loadXML(xml);
}
return dom;
}
var xml="<?xml version='1.0' encoding='utf-8'?>\
<COLLADA>\
<visual_scene id='SketchUpScene'>\
<node>\
<node>\
<instance_node url='#default'/>\
</node>\
</node>\
<node>\
<instance_camera url='#Home-camera'/>\
</node>\
</visual_scene>\
</COLLADA>";
var dom=xml2dom(xml);
a=$(dom).children("COLLADA").find("#SketchUpScene");
alert(a.length); // 1: ok
// then check that #SketchUpScene is the child of COLLADA
b=a.parent()[0].tagName;
alert(b); // COLLADA: ok
// so try to find children of COLLADA
c=$(dom).children("COLLADA").children("#SketchUpScene");
alert(c.length); // 0: bug ! it should be 1