title: XMLPullParser parsing from internet in asynctask error in Android
body: <p>I'm developing an application on the Android system which involves parsing some xml stuff. The problem is that the program is crashing and I've haven't found out the problem. I have an Activity which has a private class which extends asynctask. This is the code:</p>
  
  <pre><code>URL url = new URL(XML_INIT_ADRESS);
  XmlPullParser xpp =  XmlPullParserFactory.newInstance().newPullParser();
  xpp.setInput(url.openConnection().getInputStream(), null);
  
  int pullParserState = xpp.getEventType();
  
  while (pullParserState != XmlPullParser.END_DOCUMENT){
      if (xpp.getName().equals("signupclients") &amp;&amp; pullParserState == XmlPullParser.START_TAG){ //Error!!!               
          while(!xpp.getName().equals("signupclients") &amp;&amp; pullParserState != XmlPullParser.END_TAG){
              if (xpp.getName().equals("client")) {
                  clientNames.add(xpp.getAttributeValue(0));
              }
              pullParserState = xpp.next();
          }
          pullParserState = xpp.next();
      }
  }    
  </code></pre>
  
  <p>As you can see I've commented on the first if-statement that if you comment away that and the code its containing the code will work. I could add that it's in Eclipse and I catch all errors.</p>
  
  <pre><code>String XML_INIT_ADRESS = "http://www.johanstenberg.se/tests/app/start.xml"
  </code></pre>
  
  <p>It should be a valid XML-document. Please help because I'm clueless but I want to see it work with the XMLPullParser. I call the asynctask which in the onCreate() method like this:</p>
  
  <pre><code>new UpdateDatabase().execute();
  </code></pre>
  
  <p>Where UpdateDatabase is the name of the private class extending Asynctask.</p>
  
  <p>Thanks in advance!</p>
  
  <p>Logcat: </p>
  
  <pre><code>12-05 18:38:43.664: W/KeyCharacterMap(525): No keyboard for id 0
  12-05 18:38:43.664: W/KeyCharacterMap(525): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
  12-05 18:38:44.854: I/AndroidRuntime(525): AndroidRuntime onExit calling exit(0)
  12-05 18:38:45.154: D/dalvikvm(535): GC freed 750 objects / 54888 bytes in 51ms
  12-05 18:38:45.584: W/dalvikvm(535): threadid=15: thread exiting with uncaught exception (group=0x4001b188)
  12-05 18:38:45.594: E/AndroidRuntime(535): Uncaught handler: thread AsyncTask #1 exiting due to uncaught exception
  12-05 18:38:45.604: E/AndroidRuntime(535): java.lang.RuntimeException: An error occured while executing doInBackground()
  12-05 18:38:45.604: E/AndroidRuntime(535):  at android.os.AsyncTask$3.done(AsyncTask.java:200)
  1    2-05 18:38:45.604: E/AndroidRuntime(535):  at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
  12-05 18:38:45.604: E/AndroidRuntime(535):  at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
  12-05 18:38:45.604: E/AndroidRuntime(535):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
  12-05 18:38:45.604: E/AndroidRuntime(535):  at java.util.concurrent.FutureTask.run(FutureTask.java:137)
  12-05 18:38:45.604: E/AndroidRuntime(535):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
  12-05 18:38:45.604: E/AndroidRuntime(535):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
  12-05 18:38:45.604: E/AndroidRuntime(535):  at java.lang.Thread.run(Thread.java:1096)
  12-05 18:38:45.604: E/AndroidRuntime(535): Caused by: java.lang.NullPointerException
  12-05 18:38:45.604: E/AndroidRuntime(535):  at com.discountapp.johanaugust.UpdatingDB$UpdateDatabase.doInBackground(UpdatingDB.java:119)
  12-05 18:38:45.604: E/AndroidRuntime(535):  at com.discountapp.johanaugust.UpdatingDB$UpdateDatabase.doInBackground(UpdatingDB.java:1)
  12-05 18:38:45.604: E/AndroidRuntime(535):  at android.os.AsyncTask$2.call(AsyncTask.java:185)
  12-05 18:38:45.604: E/AndroidRuntime(535):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
  12-05 18:38:45.604: E/AndroidRuntime(535):  ... 4 more
  12-05 18:38:45.654: I/dalvikvm(535): threadid=7: reacting to signal 3
  12-05 18:38:45.654: E/dalvikvm(535): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
  </code></pre>