public void Userinfo() { String str = flag; DataCenter d = new DataCenter(con); ByteArrayInputStream bInputStringStream = null; try { if (str != null && !str.trim().equals("")) { bInputStringStream = new ByteArrayInputStream(str.getBytes()); } } catch (Exception e) { // TODO: handle exception } try { XmlPullParser xmlparser = Xml.newPullParser(); xmlparser.setInput(bInputStringStream, "UTF-8"); int eventType = xmlparser.getEventType(); String[] User_info = new String[21]; while (eventType != XmlPullParser.END_DOCUMENT) { switch (eventType) { case XmlPullParser.START_DOCUMENT:// 文档开始事件,可以进行数据初始化处理 d.open(); break; case XmlPullParser.START_TAG:// 开始元素事件 String name = xmlparser.getName();// 字段名 if (name.equalsIgnoreCase("uid")) { User_info[0] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("psw")) { User_info[1] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("name")) { User_info[2] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("major")) { User_info[3] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("department")) { User_info[4] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("email")) { User_info[5] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("unit")) { User_info[6] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("tel")) { User_info[7] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("mobile")) { User_info[8] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("postcode")) { User_info[9] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("address")) { User_info[10] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("homepage")) { User_info[11] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("regTime")) { User_info[12] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("lastTime")) { User_info[13] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("priv")) { User_info[14] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("bxlx")) { User_info[15] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("xxtz")) { User_info[16] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("orderId")) { User_info[17] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("deviceTotal")) { User_info[18] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("deviceArea")) { User_info[19] = xmlparser.nextText(); } else if (name.equalsIgnoreCase("cjType")) { User_info[20] = xmlparser.nextText(); } break; case XmlPullParser.END_TAG:// 结束元素事件 break; } eventType = xmlparser.next(); } d.insertUser(User_info); bInputStringStream.close(); d.close(); } catch (XmlPullParserException e) { // TODO Auto-generated catch block flag = null; e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block flag = null; e.printStackTrace(); } flag = null; }