title: Java.lang.NumberFormatException error: empty string- Exchange Rate application
body: <p>I'm writing a program which gets daily exchange rates from <a href="http://www.tcmb.gov.tr/kurlar/today.xml" rel="nofollow noreferrer">http://www.tcmb.gov.tr/kurlar/today.xml</a> and saves them to the List. Here is my code:                                                             </p>
  
  <pre><code>public class ParseTheXml {
  
      private List&lt;CurrencyPojo&gt; currencyList;
  
  
      public void setCurrencyList(List&lt;CurrencyPojo&gt; currencyList) {
          this.currencyList = currencyList;
      }
  
      public List&lt;CurrencyPojo&gt; getCurrencyList() throws ParserConfigurationException {
          currencyList = new ArrayList&lt;CurrencyPojo&gt;();
  
          try {
              DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
              URL url = new URL("http://www.tcmb.gov.tr/kurlar/today.xml");
              Document document = builder.parse(url.openStream());
  
              NodeList nodeList = document.getElementsByTagName("Currency");
  
              for (int i = 0; i &lt; nodeList.getLength(); i++) { // döngü her currency türü için
                  Element element = (Element) nodeList.item(i);
                  CurrencyPojo currencyPojoObject = new CurrencyPojo(); 
  
                  currencyPojoObject.setCrossOrder(Integer.parseInt(element.getAttribute("CrossOrder")));
                  currencyPojoObject.setKod(element.getAttribute("Kod"));
                  currencyPojoObject.setCurrenyCode(element.getAttribute("CurrencyCode"));
  
                  currencyPojoObject.setUnit(Integer.parseInt(element.getElementsByTagName("Unit").item(0).getTextContent()));
                  currencyPojoObject.setIsim(element.getElementsByTagName("Isim").item(0).getTextContent());
                  currencyPojoObject.setCurrencyName(element.getElementsByTagName("CurrencyName").item(0).getTextContent());
                  currencyPojoObject.setForexBuying(Double.parseDouble(element.getElementsByTagName("ForexBuying").item(0).getTextContent()));
  
  
         currencyPojoObject.setForexSelling(Double.parseDouble(element.getElementsByTagName("ForexSelling").item(0).getTextContent()));  //  Last 3 codes have Emppty String errors
                  currencyPojoObject.setBanknoteBuying(Double.parseDouble(element.getElementsByTagName("BanknoteBuying").item(0).getTextContent()));
                  currencyPojoObject.setBanknoteSelling(Double.parseDouble(element.getElementsByTagName("BanknoteSelling").item(0).getTextContent()));
  
                  currencyList.add(currencyPojoObject);
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          return currencyList;
      } 
  </code></pre>
  
  <p>On the part that getting ForexSelling, BanknoteBuying and Banknote Selling values,I get</p>
  
  <pre><code>java.lang.NumberFormatException: empty String
  at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842)
      at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
      at java.lang.Double.parseDouble(Double.java:538)
      at javaxmlparseandshow.ParseTheXml.getCurrencyList(ParseTheXml.java:55)
      at javaxmlparseandshow.ParseTheXml.main(ParseTheXml.java:75)
  </code></pre>
  
  <p>Can someone help me to fix these? Thanks in advance.</p>