title: How can I make jQuery.parseXML work in node.js
body: <p>I am trying to use jQuery parseXml in node.js</p>
  
  <p>I am getting this error:</p>
  
  <pre><code>Error: Invalid XML: &lt;?xml version="1.0"...
  </code></pre>
  
  <p>But the problem is <strong>not</strong> in the XML </p>
  
  <p>The problem is in node-jquery.js:</p>
  
  <pre><code>parseXML: function( data ) {
          if ( typeof data !== "string" || !data ) {
              return null;
          }
          var xml, tmp;
          try {
              if ( window.DOMParser ) { // Standard
                  tmp = new DOMParser();
                  xml = tmp.parseFromString( data , "text/xml" );
              } else { // IE
                  xml = new ActiveXObject( "Microsoft.XMLDOM" );
                  xml.async = "false";
                  xml.loadXML( data );
              }
          } catch( e ) {
              xml = undefined;
          }
          if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
              jQuery.error( "Invalid XML: " + data );
          }
          return xml;
      },
  </code></pre>
  
  <p>To put it simply, in node.js, there is no <strong>DOMParser</strong>, and there is no <strong>ActiveXObject( "Microsoft.XMLDOM" )</strong></p>
  
  <p>Since I am working in windows, I would expect ActiveXObject to work, but no, it does not, the actual error swallowed by jQuery is not an invalid XML it is that ActiveXObject is not defined:</p>
  
  <pre><code>ReferenceError: ActiveXObject is not defined
  at Module._compile (module.js:449:26)
  at Object.Module._extensions..js (module.js:467:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.runMain (module.js:492:10)
  at process.startup.processNextTick.process._tickCallback (node.js:244:
  </code></pre>
  
  <p>Any workarounds for this? How can I make jQuery.parseXML work?</p>