public static Tweet parse(InputStream inputStream) throws IOException, AppException {
   Tweet tweet = null;
   // 获得XmlPullParser解析器
   XmlPullParser xmlParser = Xml.newPullParser();
   try {
     xmlParser.setInput(inputStream, UTF8);
     // 获得解析到的事件类别,这里有开始文档,结束文档,开始标签,结束标签,文本等等事件。
     int evtType = xmlParser.getEventType();
     // 一直循环,直到文档结束
     while (evtType != XmlPullParser.END_DOCUMENT) {
       String tag = xmlParser.getName();
       switch (evtType) {
         case XmlPullParser.START_TAG:
           if (tag.equalsIgnoreCase(NODE_START)) {
             tweet = new Tweet();
           } else if (tweet != null) {
             if (tag.equalsIgnoreCase(NODE_ID)) {
               tweet.id = StringUtils.toInt(xmlParser.nextText(), 0);
             } else if (tag.equalsIgnoreCase(NODE_FACE)) {
               tweet.setFace(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase(NODE_BODY)) {
               tweet.setBody(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase(NODE_AUTHOR)) {
               tweet.setAuthor(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase(NODE_AUTHORID)) {
               tweet.setAuthorId(StringUtils.toInt(xmlParser.nextText(), 0));
             } else if (tag.equalsIgnoreCase(NODE_COMMENTCOUNT)) {
               tweet.setCommentCount(StringUtils.toInt(xmlParser.nextText(), 0));
             } else if (tag.equalsIgnoreCase(NODE_PUBDATE)) {
               tweet.setPubDate(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase(NODE_IMGSMALL)) {
               tweet.setImgSmall(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase(NODE_IMGBIG)) {
               tweet.setImgBig(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase(NODE_ATTACH)) {
               tweet.setAttach(xmlParser.nextText());
             } else if (tag.equalsIgnoreCase(NODE_APPCLIENT)) {
               tweet.setAppClient(StringUtils.toInt(xmlParser.nextText(), 0));
             }
             // 通知信息
             else if (tag.equalsIgnoreCase("notice")) {
               tweet.setNotice(new Notice());
             } else if (tweet.getNotice() != null) {
               if (tag.equalsIgnoreCase("atmeCount")) {
                 tweet.getNotice().setAtmeCount(StringUtils.toInt(xmlParser.nextText(), 0));
               } else if (tag.equalsIgnoreCase("msgCount")) {
                 tweet.getNotice().setMsgCount(StringUtils.toInt(xmlParser.nextText(), 0));
               } else if (tag.equalsIgnoreCase("reviewCount")) {
                 tweet.getNotice().setReviewCount(StringUtils.toInt(xmlParser.nextText(), 0));
               } else if (tag.equalsIgnoreCase("newFansCount")) {
                 tweet.getNotice().setNewFansCount(StringUtils.toInt(xmlParser.nextText(), 0));
               }
             }
           }
           break;
         case XmlPullParser.END_TAG:
           break;
       }
       // 如果xml没有结束,则导航到下一个节点
       evtType = xmlParser.next();
     }
   } catch (XmlPullParserException e) {
     throw AppException.xml(e);
   } finally {
     inputStream.close();
   }
   return tweet;
 }