无效的令牌解析

时间:2011-12-09 04:37:17

标签: android

我得到了一些无效的令牌解析问题

代码:

public class viewparty extends Activity implements OnItemClickListener {
    /** Called when the activity is first created. */
    /* declare widgets */
    String[] booking_id;
    String[] user_id1;
    String[] partyname;
    String[] email;
    String[] phone;
    String[] partytype;
    String[] venue;
    String[] date;
    String[] promoter;
    String[] guests;
    String[] compbottle;
    String[] bottleservice;
    String[] openbar;
    String[] guests2;
    String[] ticketedevent;
    String[] commission;
    String[] promotercommission;
    String[] notes;

    ArrayList<String> al_booking_id, al_user_id, al_partyname, al_email,
            al_phone, al_partytype, al_venue, al_date, al_promoter, al_guests,
            al_compbottle, al_bottleservice, al_openbar, al_guests2,
            al_ticketedevent, al_commission, al_promotercommission, al_notes;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.viewparty);

        processLogin();


}

    public void processLogin() {




            DefaultHttpClient client = new DefaultHttpClient();
            HttpPost httppost = new HttpPost(
                    "url");
            List nvps = new ArrayList();
            nvps.add(new BasicNameValuePair("api", "viewparties"));
            nvps.add(new BasicNameValuePair("userid", "15"));
            // MainActivity.UserID
            UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(nvps,
                    HTTP.UTF_8);
            httppost.setEntity(p_entity);
            HttpResponse response = client.execute(httppost);

            HttpEntity responseEntity = response.getEntity();

            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();
            XMLReader xr = sp.getXMLReader();
            viewpartyHandler myLoginHandler = new viewpartyHandler();
            xr.setContentHandler(myLoginHandler);
            xr.parse(retrieveInputStream(responseEntity));
            viewpartyDataset parsedLoginDataSet = myLoginHandler
                    .getParsedweeklypartyData();
}

错误

12-09 09:57:55.793: WARN/System.err(1686): org.apache.harmony.xml.ExpatParser$ParseException: At line 6, column 2971: not well-formed (invalid token)
12-09 09:57:55.793: WARN/System.err(1686):     at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:523)
12-09 09:57:55.805: WARN/System.err(1686):     at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:482)
12-09 09:57:55.805: WARN/System.err(1686):     at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:320)
12-09 09:57:55.805: WARN/System.err(1686):     at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:277)
12-09 09:57:55.805: WARN/System.err(1686):     at com.easyMarketing.viewparty.processLogin(viewparty.java:130)
12-09 09:57:55.815: WARN/System.err(1686):     at com.easyMarketing.viewparty.onCreate(viewparty.java:88)
12-09 09:57:55.815: WARN/System.err(1686):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-09 09:57:55.815: WARN/System.err(1686):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-09 09:57:55.824: WARN/System.err(1686):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-09 09:57:55.824: WARN/System.err(1686):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-09 09:57:55.824: WARN/System.err(1686):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-09 09:57:55.824: WARN/System.err(1686):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-09 09:57:55.834: WARN/System.err(1686):     at android.os.Looper.loop(Looper.java:123)
12-09 09:57:55.834: WARN/System.err(1686):     at android.app.ActivityThread.main(ActivityThread.java:4627)
12-09 09:57:55.834: WARN/System.err(1686):     at java.lang.reflect.Method.invokeNative(Native Method)
12-09 09:57:55.855: WARN/System.err(1686):     at java.lang.reflect.Method.invoke(Method.java:521)
12-09 09:57:55.865: WARN/System.err(1686):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-09 09:57:55.875: WARN/System.err(1686):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-09 09:57:55.875: WARN/System.err(1686):     at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:1)

正如其他评论所说,错误通常来自格式不正确的XML。

它确实给你一个位置:

在第6行第2971栏:格式不正确(无效令牌)

检查特殊字符;经常错过的是&符号&amp;

这也可能是由未关闭的标签IIRC

引起的