title: Self-closing tag in xml parsing using java
body: <p>I'm trying to parse an xml file to get news from rss feed. But self closing, empty tags are not parsed properly. Some of the items doesnt have a description tag.</p>
  
  <p>My xml looks like this</p>
  
  <pre><code>&lt;rss version="2.0"&gt;
    &lt;channel&gt;
      &lt;title&gt;Tata Group&lt;/title&gt;
      &lt;link&gt;http://www.tata.com&lt;/link&gt;
      &lt;description&gt;
      Tata is a rapidly growing business group based in India with significant international operations. The business operations of the Tata Group currently encompass seven business sectors: communications and information technology, engineering, materials, services, energy, consumer products and chemicals.
      &lt;/description&gt;
      &lt;copyright&gt;Copyright (C) 2014 Tata Sons Ltd&lt;/copyright&gt;
      &lt;item&gt;
        &lt;title&gt;Tata Power commissions waste water recovery plant at power house #6, Jamshedpur
        &lt;/title&gt;
        &lt;link&gt;
          http://www.tata.com/rssread.aspx?artid=tiEeXsbwZ54=
        &lt;/link&gt;
        &lt;description&gt;Jamshedpur: Tata Power, India's largest integrated power company, has adopted several innovative technological solutions to improve the plant processes at its generation faciliti...
        &lt;/description&gt;
        &lt;pubDate&gt;22 Jul 2014 12:00:00 GMT&lt;/pubDate&gt;
      &lt;/item&gt;
      &lt;/channel&gt;
      &lt;/rss&gt;
  </code></pre>
  
  <p>Currently what I'm getting is, I could see all the items that has non-empty description tags and all the items with empty self closing description tags are skipped. </p>
  
  <pre><code>try {
          XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
          XmlPullParser xpp = factory.newPullParser();
          FileReader xmlReader = new FileReader(destination);
          xpp.setInput(xmlReader);
          int eventType = xpp.getEventType();
          String NodeValue;
          while (eventType != XmlPullParser.END_DOCUMENT) {
              switch (eventType) {
              case XmlPullParser.START_DOCUMENT:
                  break;
              case XmlPullParser.START_TAG:
                  NodeValue = xpp.getName();// Start of a Node
                  if (NodeValue.equalsIgnoreCase("item")) {
                      flagItem = true;
                  } else if (NodeValue.equalsIgnoreCase("title") &amp;&amp; flagItem) {
                      eventType = xpp.next();
                      if (eventType == XmlPullParser.TEXT) {
                          message.setTitle(xpp.getText());
                      }
                  } else if (NodeValue.equalsIgnoreCase("description/") &amp;&amp; flagItem) {
                      message.setDescription("Description not available..");
                      Log.out(logFlag, logTag, "Reaching the critical point...........  self closing tag reached!!!");
                      flagItem = false;
                      list.add(message);
                      message = null;
                      message = new Message();
  
                  } else if (NodeValue.equalsIgnoreCase("description") &amp;&amp; flagItem) {
                      eventType = xpp.next();
                      if (eventType == XmlPullParser.TEXT) {
                          message.setDescription(xpp.getText());
                          flagItem = false;
                          list.add(message);
                          message = null;
                          message = new Message();
                      }
                  }
                  break;
              }
              eventType = xpp.next();
              Log.out(logFlag, logTag, "xml file downloaded : "+list);
  </code></pre>