title: java dom parser- how to check if an element is null or not
body: <p>I am trying to parse an xml file in which there is a group element "patent-assignee" which contains some elements- name, address1, address2,city,state, postcode, country.</p>
  
  <p>While values will always be there for "name" and "address1" the other elements may or may not have values.</p>
  
  <p>I have navigated to a single patent-assignee element, and now want to check if this record has value for address2 (and other fields) or not.</p>
  
  <p>Some relevant code is given below--</p>
  
  <pre><code>el_patentassignees= (Element) npassignee.item(ncount);
  //now el_patentassignee has in it the content of one patent assignee element
  
  el_assigneeaddress2= (Element) el_patentassignees.getElementsByTagName("address2").item(0);
  
  val_assigneeaddress2= el_assigneeaddress2.getTextContent();
  </code></pre>