title: Android XML Pull Parser - After parsing self closing tag, tag's attribute can't be show
body: <p>I want to parse tag's attribute from xml self closing tag, from this site :
  <a href="http://api.yr.no/weatherapi/locationforecast/1.9/?lat=-6.1980042;lon=106.8243594" rel="nofollow">http://api.yr.no/weatherapi/locationforecast/1.9/?lat=-6.1980042;lon=106.8243594</a></p>
  
  <p>I using this code :</p>
  
  <p>Main Activity.java :</p>
  
  <pre><code>public static ArrayList&lt;Datum&gt; parse(String url) throws IOException, XmlPullParserException {
          final ArrayList&lt;Datum&gt; results = new ArrayList&lt;Datum&gt;();
  
      URL input = new URL(url);
  
      XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
      factory.setNamespaceAware(true);
      XmlPullParser xpp = factory.newPullParser();
  
      xpp.setInput(input.openStream(), null);
      int eventType = xpp.getEventType();
      String currentTag = null;
      String temperature = null;
  
      while (eventType != XmlPullParser.END_DOCUMENT) {
          if (eventType == XmlPullParser.START_TAG) {
              currentTag = xpp.getName();
          } else if (eventType == XmlPullParser.TEXT) {
              Log.d("MainActivity", "Masuk Start Tag" );
              if ("temperature".equals(currentTag)) {
                  temperature = xpp.getAttributeValue(1);
              }
  
          } else if (eventType == XmlPullParser.END_TAG) {
              if ("location".equals(xpp.getName())) {
                  results.add(new Datum(temperature));
              }
          }
          eventType = xpp.next();
      }
      return results;
  }
  
  public static ArrayList&lt;Datum&gt; parse2(String url) throws IOException, XmlPullParserException {
      final ArrayList&lt;Datum&gt; results = new ArrayList&lt;Datum&gt;();
  
      URL input = new URL(url);
  
      XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
      factory.setNamespaceAware(true);
      XmlPullParser xpp = factory.newPullParser();
  
      xpp.setInput(input.openStream(), null);
      xpp.nextTag();
      xpp.require(XmlPullParser.START_TAG, null, "weatherdata");
      while (xpp.nextTag() == XmlPullParser.START_TAG) {
  
          xpp.require(XmlPullParser.START_TAG, null, "product");
          while (xpp.nextTag() == XmlPullParser.START_TAG) {
  
              xpp.require(XmlPullParser.START_TAG, null, "time");
              while (xpp.nextTag() == XmlPullParser.START_TAG) {
  
                  xpp.require(XmlPullParser.START_TAG, null, "location");
                  xpp.nextTag();
                  xpp.require(XmlPullParser.START_TAG, null, "temperature");
                  String temperature = xpp.getAttributeValue(1);
                  Log.d("MainActivity", "getAttrbuteValue : " + xpp.getAttributeValue(1));
  
  
                  xpp.nextTag();
                  xpp.require(XmlPullParser.END_TAG, null, "location");
                  results.add(new Datum(temperature));
              }
              xpp.require(XmlPullParser.END_TAG, null, "time");
          }
          xpp.require(XmlPullParser.END_TAG, null, "product");
      }
      xpp.require(XmlPullParser.END_TAG, null, "weatherdata");
  
      return results;
  }
  
  protected class LoadRecipesTask2 extends AsyncTask&lt;String, Integer, ArrayList&lt;Datum&gt;&gt; {
  
      @Override
      protected void onPreExecute() {
          mProgressDialog.show();                                                          // 1
      }
  
      @Override
      protected ArrayList&lt;Datum&gt; doInBackground(String... urls) {
          ArrayList&lt;Datum&gt; datumList = new ArrayList&lt;Datum&gt;();
          for (int i = 0; i &lt; urls.length; i++) {                                          // 2
              try {
                  datumList = parse(urls[i]);
                  publishProgress((int) (((i+1) / (float) urls.length) * 100));            // 3
              } catch (IOException e) {
                  e.printStackTrace();
              } catch (XmlPullParserException e) {
                  e.printStackTrace();
              }
          }
          return datumList;
      }
  
      @Override
      protected void onProgressUpdate(Integer... values) {                                 // 4
          mProgressDialog.setProgress(values[0]);                                          // 5
      }
  
      @Override
      protected void onPostExecute(ArrayList&lt;Datum&gt; result) {
          mListView.setAdapter(new ArrayAdapter&lt;Datum&gt;(MainActivity.this, R.layout.list_item, result));
          mProgressDialog.dismiss();                                                       // 6
      }
  }
  </code></pre>
  
  <p>Where Datum class is like this :</p>
  
  <pre><code>package nl.codestone.recipelist;
  public class Datum {
  
  String temperature;
  
  public Datum(String temperature) {
      this.temperature = temperature;
  
  }
  
  public String getTemperature() {
      return temperature;
  }
  
  }
  </code></pre>
  
  <p>I want to get the temperature's value attribute, but the value is also appear something like this :
  nl.codestone.recipelist.Datum@11a4d5920</p>
  
  <p>Anybody can help ?</p>