Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6933593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:51:09+00:00 2026-05-27T11:51:09+00:00

I’m developing an application on the Android system which involves parsing some xml stuff.

  • 0

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:

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") && pullParserState == XmlPullParser.START_TAG){ //Error!!!               
        while(!xpp.getName().equals("signupclients") && pullParserState != XmlPullParser.END_TAG){
            if (xpp.getName().equals("client")) {
                clientNames.add(xpp.getAttributeValue(0));
            }
            pullParserState = xpp.next();
        }
        pullParserState = xpp.next();
    }
}    

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.

String XML_INIT_ADRESS = "http://www.johanstenberg.se/tests/app/start.xml"

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:

new UpdateDatabase().execute();

Where UpdateDatabase is the name of the private class extending Asynctask.

Thanks in advance!

Logcat:

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:51:09+00:00Added an answer on May 27, 2026 at 11:51 am

    If you are getting an exception from this line:

    if(xpp.getName().equals("signupclients") && pullParserState == XmlPullParser.START_TAG)
    

    Then my best guess is that xpp.getName() is returning null, and you are trying to invoke .equals() from that null reference.

    You should be checking the eventType from your XmlPullParser before trying to do something with it. Take a look at this snippet from the JavaDoc:

             int eventType = xpp.getEventType();
             while (eventType != XmlPullParser.END_DOCUMENT) {
              if(eventType == XmlPullParser.START_DOCUMENT) {
                  System.out.println("Start document");
              } else if(eventType == XmlPullParser.START_TAG) {
                  System.out.println("Start tag "+xpp.getName());
              } else if(eventType == XmlPullParser.END_TAG) {
                  System.out.println("End tag "+xpp.getName());
              } else if(eventType == XmlPullParser.TEXT) {
                  System.out.println("Text "+xpp.getText());
              }
              eventType = xpp.next();
             }
    

    Its hard to give a more definitive answer without more details (like a stack trace).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I'm parsing an XML file, the creators of it stuck in a bunch social
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.