Rss parsing issue (XML)
<p>This is my RSS ,XML file from which i want to extract the data. I have done my whole work with the SAX parser every thing works fine. But I parsed the whole RSS file and getting the each single element data like . </p>

<p>But my problem is i'm getting the whole file  element data but i want only  elements which are in  only.</p>

<pre><code>&lt;rss version="2.0"&gt;
&lt;channel&gt;
&lt;title&gt;RSS Feed&lt;/title&gt;
&lt;link&gt;http://www.xyz.com&lt;/link&gt;
&lt;description&gt;Calendar RSS Feeds&lt;/description&gt;
&lt;language&gt;en-us&lt;/language&gt;
&lt;ttl&gt;60&lt;/ttl&gt;
&lt;item&gt;
&lt;title&gt;
title 1
&lt;/title&gt;
&lt;description&gt;description 1&lt;/description&gt;
&lt;link&gt;
http://www.xyz.com
&lt;/link&gt;
&lt;guid isPermaLink="false"&gt;6027@http://www.xyz.com&lt;/guid&gt;
&lt;/item&gt;
&lt;item&gt;
&lt;title&gt;
title 2
&lt;/title&gt;
&lt;description&gt;description 2&lt;/description&gt;
&lt;link&gt;
http://www.xyz.com
&lt;/link&gt;
&lt;guid isPermaLink="false"&gt;5554@http://www.xyz.com&lt;/guid&gt;
&lt;/item&gt;
&lt;item&gt;
&lt;/channel&gt;
&lt;/rss&gt;
</code></pre>

<p>I had tried all the combinations to set this i'll show my code here i made startElement and 
endElement methods:-</p>

<pre><code>public void startElement(String uri, String localName, String qName,
            Attributes attributes) throws SAXException {
        // TODO Auto-generated method stub

        current = true;

        if (localName.equals("channel"))
        {
            itemList = new ItemList();
        }
    }

    @Override
    public void endElement(String uri, String localName, String qName)
            throws SAXException {
        // TODO Auto-generated method stub
        current = false;

        if(localName.equals("title"))
        {
            itemList.setTitle(currentValue);
        }

    }

    @Override
    public void characters(char[] ch, int start, int length)
            throws SAXException {
        // TODO Auto-generated method stub

        if(current)
        {
            currentValue = new String(ch, start, length);
            current=false;
        }
    }
</code></pre>

<p>Any one please suggest me how can i only retrive the  elements which are in under  elements only. </p>

<p>I also tried this but this gives me error</p>

<pre><code>public void startElement(String uri, String localName, String qName,
            Attributes attributes) throws SAXException {
        // TODO Auto-generated method stub

        current = true;

        if (localName.equals("channel"))
        {
            if (localName.equals("item"))
            {
            itemList = new ItemList();
            }
        }
    }
</code></pre>

<p>Thanks In Advance.</p>
