title: Is it possible to simplify this try catch?
body: <p>I have a question:
  Is it possible to simplify these try catch?</p>
  
  <p>Is it possible to only have one try catch and do the transformation in one catch? (Like "If ligne1 == null, ligne 1 = "", if pays == null, pays = "" etc...)
  Thank you very much :)</p>
  
  <pre><code>try {
      ligne1 = lignes.item(0).getAttributes().item(0).getTextContent();
  }catch (NullPointerException e){
      ligne1 = "";
  }
  try{
      ligne2 = lignes.item(1).getAttributes().item(0).getTextContent();
  }catch (NullPointerException e){
      ligne2 = "";
  }
  try{
      ville = address.getElementsByTagName("city").item(0).getAttributes().item(0).getTextContent();
  }catch (NullPointerException e){
      ville = "";
  }
  try {
      pays = address.getElementsByTagName("country").item(0).getAttributes().item(0).getTextContent();
  }catch (NullPointerException e){
      pays = "";
  }
  </code></pre>
  
  <p>EDIT:
  The NullPointerException is thrown by item(0) if getElementsByTagName returns null. A solution could be to test if getElementsByTagName returns Null or not?</p>