title: Path For XMl File in Java
body: <p>I don't normally post on these sites as usually you find find what you're looking for somewhere on the net. however, after reading every single word of the documentation and reading about a million web pages this is my last hope.</p>
  
  <p>it's something really simple, i'm trying to parse an xml document from a file in my project but no matter what path i use i keep getting a file does not exist error. i have tried EVERY single possible path i can think of. i know i'm making a simple mistake but i just can't figure it out.</p>
  
  <p>here's the start of my code:</p>
  
  <pre><code>File fXmlFile = new File("/fixtures.xml");
  DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
  DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
  Document doc = dBuilder.parse(fXmlFile);
  </code></pre>
  
  <p>i've tried putting the <code>/fixtures.xml</code> file in the assets folder, the src folder and changing the path accordingly but nothing seems to work.</p>
  
  <p>///////////
  i've now moved on trying to access the xml file remotely but this isn't working either. i am using code from tutorials that should obviously work. i can see the file in my local directory and the xml file been uploaded ok so does anyone know what might be going wrong. is there a setting in my project that needs to be changed??</p>
  
  <p>this is the code i'm using to get the xml from the web. you can check the url to see that's it's pointing to the right place.</p>
  
  <pre><code>try {
  URL url = new URL(
  "http://www.spursart.com/fixtures.xml");
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  Document doc = db.parse(new InputSource(url.openStream()));
  doc.getDocumentElement().normalize();
  }
  catch (Exception e) {
  System.out.println("XML Pasing Excpetion = " + e);
  }
  </code></pre>