title: Phonegap: How to read and parse a local XML in browser
body: <p>I'm trying to read an xml file so I can learn how to, I have my test xml file in local and I'm trying to open and parse it.</p>
  
  <p>All I find when I google for info is people asking how to solve their problems when parsing, but none of them explains how to open the file in first place.</p>
  
  <p>I found this code:</p>
  
  <pre><code>if (window.XMLHttpRequest)
      {
          // code for IE7+, Firefox, Chrome, Opera, Safari
          xmlhttp=new XMLHttpRequest();
      }
      else
      {
          // code for IE6, IE5
          xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.open("GET","entrada.xml",false);
      xmlhttp.send();
      xmlDoc = xmlhttp.responseXML;
  </code></pre>
  
  <p>But when testing on browser (Chrome) I get this error:</p>
  
  <pre><code>XMLHttpRequest cannot load file:///Users/.../cursos/www/entrada.xml. Cross origin requests are only supported for HTTP.
  Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file:///Users/.../cursos/www/entrada.xml'. 
  </code></pre>
  
  <p>I don't want to use a device if can avoid. How can I test it on browser??</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Found a way to make it work thanks to @Regent and @mehsen.</p>
  
  <p>I needed to get the file in a different way if on browser or device as said <a href="https://stackoverflow.com/questions/8449716/cross-origin-requests-are-only-supported-for-http-but-its-not-cross-domain">here</a>, and then, one I have the file, read it as said <a href="https://stackoverflow.com/questions/5744064/html5-file-api-reading-in-an-xml-text-file-and-displaying-it-on-the-page">here</a> and <a href="https://stackoverflow.com/questions/20853219/how-to-read-xml-file-using-filereader-javascript">here</a>.</p>