title: Sax parsing of local xml file in android
body: <p>i want to parse country it is present in xml folder 
  </p>
  
  <pre><code>&lt;My_location_country&gt;
      &lt;Country_str_code&gt;AW&lt;/Country_str_code&gt;
      &lt;Country_str_name&gt;Aruba&lt;/Country_str_name&gt;
  &lt;/my_location_country&gt;
  </code></pre>
  
  <p>.......................
  i want to display country name in array adapter whn i selecte the country i want the countrycode to be print i am using following method but it is not working </p>
  
  <pre><code>                   try {
  
                          SAXParserFactory factory = SAXParserFactory.newInstance();
                          SAXParser saxParser = factory.newSAXParser();
  
                          DefaultHandler handler = new DefaultHandler() {
  
                          boolean countryflag = false;
                          boolean countryidflag = false;
  
  
                          public void startElement(String uri, String localName,String qName, 
                                      Attributes attributes) throws SAXException {
  
                              System.out.println("Start Element :" + qName);
  
                              if (qName.equalsIgnoreCase("Country_str_code")) {
                                  countryidflag = true;
                              }
  
                              if (qName.equalsIgnoreCase("Country_str_name")) {
                                  countryflag = true;
                              }
  
  
                          }
  
                          public void endElement(String uri, String localName,
                              String qName) throws SAXException {
  
                              System.out.println("End Element :" + qName);
  
                          }
  
                          public void characters(char ch[], int start, int length) throws SAXException {
  
                              if (countryidflag) {
                                  System.out.println("Country_str_code" + new String(ch, start, length));
                                  String val=new String(ch, start, length);
  
                                  countryid.add(val);
                                  countryidflag = false;
                              }
  
                              if (countryflag) {
                                  System.out.println("Country_str_name " + new String(ch, start, length));
                                  String val1=new String(ch, start, length);
                                  countryname.add(val1);
  
                                  countryflag = false;
                              }
                       }
  
                           };
  
                           File file = new File("res/xml/country.xml");
                           InputStream inputStream= new FileInputStream(file);
                           Reader reader = new InputStreamReader(inputStream,"UTF-8");
  
                           InputSource is = new InputSource(reader);
                           is.setEncoding("UTF-8");
                             //saxParser.parse();
                           } catch (Exception e) {
                             e.printStackTrace();
                           }
  </code></pre>
  
  <p>in file location i am getting error
  any help..............thanx in advance </p>