title: Detect xml object type
body: <p>I've struggled for ages to implement a robust browser-independant means to load and navigate (using xpath) xml files within javascript; particularly where IE is concerned.</p>
  
  <p>I've read with interest (Ref: <a href="http://msdn.microsoft.com/en-us/library/ie/ms534370(v=vs.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ie/ms534370(v=vs.85).aspx</a> - remarks paragraph which leads to <a href="http://blogs.msdn.com/b/ie/archive/2012/07/19/xmlhttprequest-responsexml-in-ie10-release-preview.aspx" rel="nofollow">http://blogs.msdn.com/b/ie/archive/2012/07/19/xmlhttprequest-responsexml-in-ie10-release-preview.aspx</a>) that IE started supporting <strong>XMLHttpRequest</strong> a while ago (IE8 or 9) but <strong>.responseXML</strong> still returned an <strong>MSXML</strong> object rather than a native XML object.  In IE10 it may or may not return a native XML object.  </p>
  
  <p>Furthermore, I've also found that if I happen to have an ActiveX version (where doc may or may not be an ActiveX object), then:</p>
  
  <pre><code>if(doc.selectNodes)
    return doc.selectNodes(....);
  </code></pre>
  
  <p>causes an exception on the if expression instead of just evaluating to falsey which is a pain in the a***.</p>
  
  <p>As such (and here is my question!), it it true that even if IE returns a native XML object from <strong>XHR.responseXML</strong>, we still cannot use document.evaluate (or <strong>xmlDoc.evaluate</strong>) to perform xpath navigation?</p>
  
  <p>I seem to have found that if I use XHR in IE and get a Native XML Document back I have no means at all to perform xpath (<strong>.evaluate</strong> doesn't work, neither does <strong>.selectNodes</strong>/ <strong>.selectSingleNode</strong>).  The result is, I am having to forcibly use <strong>new ActiveXObject("Msxml2.DOMDocument.3.0")</strong> instead of XHR for all IE!</p>
  
  <p>Any advice, would be great.  I can't believe I have to use <strong>Msxml2.DOMDocument.3.0</strong> in IE if I want to use xpath!</p>
  
  <p>Thanks.</p>