how to handle empty tag xml response from php webservice beacuse tag has no value </no_of_comments> in this tag
<p>In my xml there can be empty tags like The problem is that when I parse the xml, I am getting null pointer exception when I reach this line in the xml. How should I check tags like this in my parsing file? Please help me out. </p>

<p>NodeList nl =doc.getElementsByTagName ("post_details");</p>

<pre><code>                ArrayList&lt;String&gt;aryNoOfcomment = new ArrayList&lt;String&gt;();



      for (int i = 0;i&lt;nl.getLength();i++) 


    Element e = (Element) nl.item (i);


    imgThumb = e.getElementsByTagName ("user_Profile_pics"). item (0). getFirstChild (). getNodeValue ();
    posttitleDetails = e.getElementsByTagName ("post_title"). item (0). getFirstChild (). getNodeValue ();

    postimgurl = e.getElementsByTagName ("post_mage_url"). item (0). getFirstChild (). getNodeValue ();
    username = e.getElementsByTagName ("user_name"). item (0). getFirstChild (). getNodeValue ();
    grade = e.getElementsByTagName ("grade"). item (0). getFirstChild (). getNodeValue ();
</code></pre>

<p>//here    crash  this app because "no_of_comments" this tag find onle one response from php webservice in first tag and second tag is empty</p>

<pre><code> String   noOfcomment = e.getElementsByTagName ("no_of_comments"). item (0). getFirstChild ().     getNodeValue ();
   aryNoOfcomment.add(i, noOfcomment);



        menuItem.add(imgThumb);
        DatailsItem.add(posttitleDetails);
        aryUsername.add(username);
        aryGrade.add(grade);

      aryUserprofilepics.add(postimgurl);
</code></pre>
