Problem in SAX parser
<blockquote>
  <p>i need to get information from xml file.<br>
      my problem is i cant get proper response from xml file</p>
</blockquote>

<pre><code>package com.xmlparser;

import java.net.URL;
import java.util.ArrayList;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class xmlparser extends Activity {
    /** Called when the activity is first created. */
     detaset dt=null;
     detaset  Date;
     ArrayList&lt;String&gt;  Score;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       try
       {
        URL url = new URL("C://Users//nik//Desktop//a.xml");
        System.out.println(url);
        TextView tv = new TextView(this);
        /* Get a SAXParser from the SAXPArserFactory. */
        SAXParserFactory spf = SAXParserFactory.newInstance();
        SAXParser sp = spf.newSAXParser();

        /* Get the XMLReader of the SAXParser we created. */
        XMLReader xr = sp.getXMLReader();
        /* Create a new ContentHandler and apply it to the XML-Reader*/
        Handler myExampleHandler = new Handler();
        xr.setContentHandler(myExampleHandler);

        /* Parse the xml-data from our URL. */
        xr.parse(new InputSource(url.openStream()));
        /* Parsing has finished. */

        /* Our ExampleHandler now provides the parsed data to us. */
        detaset parsedExampleDataSet = myExampleHandler.getParsedData();

        /* Set the result to be displayed in our GUI. */
        System.out.println(parsedExampleDataSet.toString());

       // Date  = myExampleHandler.getParsedData();


        //System.out.println(Date);
        this.setContentView(tv);


       }catch (Exception e) {
        e.printStackTrace();
    }
       }
    // TODO: handle exception

/* Display the TextView. */


    }
</code></pre>

<hr>

<pre><code>package com.xmlparser;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;


public class Handler extends DefaultHandler{

        // ===========================================================
        // Fields
        // ===========================================================

        private boolean NewDataSet  = false;
        private boolean Table = false;
        private boolean Date = false;
        private boolean Score = false;

        private detaset myParsedExampleDataSet = new detaset();

        // ===========================================================
        // Getter &amp; Setter
        // ===========================================================

        public detaset getParsedData() {
                return this.myParsedExampleDataSet;
        }

        // ===========================================================
        // Methods
        // ===========================================================
        @Override
        public void startDocument() throws SAXException {
                this.myParsedExampleDataSet = new detaset();
        }

        @Override
        public void endDocument() throws SAXException {
                // Nothing to do
        }

        /** Gets be called on opening tags like:
         * &lt;tag&gt;
         * Can provide attribute(s), when xml was like:
         * &lt;tag attribute="attributeValue"&gt;*/
        @Override
        public void startElement(String namespaceURI, String localName,
                        String qName, Attributes atts) throws SAXException {
                if (localName.equals("NewDataSet")) {
                        this.NewDataSet = true;
                }else if (localName.equals("Table")) {
                        this.Table = true;
                }else if (localName.equals("Date")) {
                        this.Date = true;
                }else if (localName.equals("Score")) {
                        // Extract an Attribute
                       this.Score = true;
                                        }
        }

        /** Gets be called on closing tags like:
         * &lt;/tag&gt; */
        @Override
        public void endElement(String namespaceURI, String localName, String qName)
                        throws SAXException {
                if (localName.equals("NewDataSet")) {
                        this.NewDataSet = false;
                        System.out.println("Newdataset"+NewDataSet);
                }else if (localName.equals("Table")) {
                        this.Table = false;
                        System.out.println("Table"+Table);
                }else if (localName.equals("Date")) {
                        this.Date = false;
                }else if (localName.equals("Score")) {
                        // Nothing to do here
                    this.Score = false;
                    System.out.println("Score"+Score);
                }
        }

        /** Gets be called on the following structure:
         * &lt;tag&gt;characters&lt;/tag&gt; */
        @Override
    public void characters(char ch[], int start, int length) {
                if(this.Date){
                myParsedExampleDataSet.setDate(new String(ch, start, length));
                }
                if(this.Score){
                    myParsedExampleDataSet.setScore(new String(ch, start, length));
                    }

        }





    }
</code></pre>

<hr>

<pre><code>package com.xmlparser;
public class detaset {
    private String Date =  null;
    private String Score = null;




     public void setDate(String Date) {
            this.Date = Date;
        }
        public String getDate()
        {
            return Date;
        }


        public void setScore(String Score) {
            this.Score = Score;
        }
        public String getScore()
        {
            return Score;
        }








}




&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
- &lt;DataSet xmlns="http://tempuri.org/"&gt;
- &lt;xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"&gt;
- &lt;xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"&gt;
- &lt;xs:complexType&gt;
- &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
- &lt;xs:element name="Table"&gt;
- &lt;xs:complexType&gt;
- &lt;xs:sequence&gt;
  &lt;xs:element name="Date" type="xs:string" minOccurs="0" /&gt; 
  &lt;xs:element name="Score" type="xs:string" minOccurs="0" /&gt; 
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  &lt;/xs:choice&gt;
  &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
- &lt;diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"&gt;
- &lt;NewDataSet xmlns=""&gt;
- &lt;Table diffgr:id="Table1" msdata:rowOrder="0"&gt;
  &lt;Date&gt;12/5/2011&lt;/Date&gt; 
  &lt;Score&gt;5&lt;/Score&gt; 
  &lt;/Table&gt;
- &lt;Table diffgr:id="Table2" msdata:rowOrder="1"&gt;
  &lt;Date&gt;45/5/2011&lt;/Date&gt; 
  &lt;Score&gt;54&lt;/Score&gt; 
  &lt;/Table&gt;
  &lt;/NewDataSet&gt;
  &lt;/diffgr:diffgram&gt;
  &lt;/DataSet&gt;
</code></pre>
