title: Java parsing xml from url
body: <p>I need to create a application in java that can parse the xml doc (i write USD and i should get in return the rate for it)
  <a href="http://www.bnr.ro/nbrfxrates.xml" rel="nofollow">http://www.bnr.ro/nbrfxrates.xml</a> 
  My Code right now looks like:</p>
  
  <pre><code>package bnr;
  
  import java.net.URL;
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  import org.w3c.dom.Document;
  
  
  public class Bnr {
  
      /**
       * @param args the command line arguments
       */
  
      String url = "http://www.bnr.ro/nbrfxrates.xml";
      public static void main(String[] args) {
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
          DocumentBuilder db = dbf.newDocumentBuilder();
          Document doc = db.parse(new URL(url).openStream());
      }
  }
  </code></pre>
  
  <p>and its not working i get a parse error.
  Can you please tell me what is wrong with it.
  Thank you,</p>