XML解析错误意外的令牌位置:TEXT @ 1:2?

时间:2016-04-19 08:00:32

标签: java android xml xml-parsing xmlpullparser

显示的错误是

意外的令牌(位置:java.io.StringReader@41d569a8中的TEXT @ 1:2)

我正在关注本教程 AndroidHive

但是当我使用其他网址时

http://example.com/ss.svc/APIabc?A=10&Key=XXXXX&From=19&To=221&Date=19-Apr-2016)解析数据显示我的错误,如

  04-19 15:39:17.349: E/Error:(29642): Unexpected token (position:TEXT @1:2 in java.io.StringReader@41d501a8) 
04-19 15:39:17.349: D/AndroidRuntime(29642): Shutting down VM
04-19 15:39:17.349: W/dalvikvm(29642): threadid=1: thread exiting with uncaught exception (group=0x41322438)
04-19 15:39:17.379: E/AndroidRuntime(29642): FATAL EXCEPTION: main
04-19 15:39:17.379: E/AndroidRuntime(29642): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.androidhive/com.example.androidhive.CustomizedListView}: java.lang.NullPointerException
04-19 15:39:17.379: E/AndroidRuntime(29642):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2114)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2139)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at android.app.ActivityThread.access$700(ActivityThread.java:143)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at android.os.Looper.loop(Looper.java:137)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at android.app.ActivityThread.main(ActivityThread.java:4960)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at java.lang.reflect.Method.invokeNative(Native Method)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at java.lang.reflect.Method.invoke(Method.java:511)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at dalvik.system.NativeStart.main(Native Method)
04-19 15:39:17.379: E/AndroidRuntime(29642): Caused by: java.lang.NullPointerException
04-19 15:39:17.379: E/AndroidRuntime(29642):    at com.example.androidhive.CustomizedListView.onCreate(CustomizedListView.java:48)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at android.app.Activity.performCreate(Activity.java:5203)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
04-19 15:39:17.379: E/AndroidRuntime(29642):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2078)

我的XML格式是这样的

 <APIabc xmlns="http://exapmle.org/">
    <APIabcd xmlns:a="http://ac.ssc.org/2014/21/abfaggkk" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <Route>
    <Time>2016-04-13 06:11:00 AM</Time>
    <Avail>xyz</Avail>
<thumb_url>http://api.androidhive.info/music/images/adele.png</thumb_url>
    <BusLabel/>
    </Route>
    </APIabc>
    </APIabcd>

0 个答案:

没有答案