예제 #1
0
 @Override
 public ProtocolData parserBody(XmlPullParser parser) throws XmlPullParserException, IOException {
   // TODO Auto-generated method stub
   ProtocolData res = new ProtocolData("msgbody", null);
   int eventType = parser.getEventType();
   while (eventType != XmlPullParser.END_DOCUMENT) {
     switch (eventType) {
       case XmlPullParser.START_TAG:
         {
           // 姓名
           if (parser.getName().compareTo("result") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData r = new ProtocolData("result", temp);
               res.addChild(r);
             }
             // 身份证
           } else if (parser.getName().compareTo("message") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData r = new ProtocolData("message", temp);
               res.addChild(r);
             }
           }
         }
         break;
       case XmlPullParser.END_TAG:
         {
           if (parser.getName().compareTo("msgbody") == 0) {
             return res;
           }
         }
         break;
       case XmlPullParser.TEXT:
         {
         }
         break;
     }
     eventType = parser.next();
   }
   return res;
 }
예제 #2
0
 /**
  * 解析图片
  *
  * @param parser
  * @return
  * @throws XmlPullParserException
  * @throws IOException
  */
 public ProtocolData parserPic(XmlPullParser parser, ProtocolData res)
     throws XmlPullParserException, IOException {
   // TODO Auto-generated method stub
   int eventType = parser.getEventType();
   while (eventType != XmlPullParser.END_DOCUMENT) {
     switch (eventType) {
       case XmlPullParser.START_TAG:
         {
           // 自增长ID
           if (parser.getName().compareTo("picid") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData r = new ProtocolData("picid", temp);
               res.addChild(r);
             }
           }
           // 图片类型
           else if (parser.getName().compareTo("pictype") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData r = new ProtocolData("pictype", temp);
               res.addChild(r);
             }
           }
           // 图片地址
           else if (parser.getName().compareTo("picpath") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData r = new ProtocolData("picpath", temp);
               res.addChild(r);
             }
           }
           // 管理图片类型
           else if (parser.getName().compareTo("uploadpictype") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData r = new ProtocolData("uploadpictype", temp);
               res.addChild(r);
             }
           }
           // 存放地址
           else if (parser.getName().compareTo("uploadurl") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData r = new ProtocolData("uploadurl", temp);
               res.addChild(r);
             }
           }
           // 上传方式
           else if (parser.getName().compareTo("uploadmethod") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData r = new ProtocolData("uploadmethod", temp);
               res.addChild(r);
             }
           }
         }
         break;
       case XmlPullParser.END_TAG:
         {
           if (parser.getName().compareTo("aupic") == 0) {
             return res;
           }
         }
         break;
       case XmlPullParser.TEXT:
         {
         }
         break;
     }
     eventType = parser.next();
   }
   return res;
 }
예제 #3
0
 private void parserHelpItem(XmlPullParser parser, ProtocolData parent)
     throws XmlPullParserException, IOException {
   // TODO Auto-generated method stub
   // HashMap<String, List<ProtocolData>> res = new HashMap<String,
   // List<ProtocolData>>();
   int eventType = parser.getEventType();
   while (eventType != XmlPullParser.END_DOCUMENT) {
     switch (eventType) {
       case XmlPullParser.START_TAG:
         {
           if (parser.getName().compareTo("rechaMoneyid") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData data = new ProtocolData("rechaMoneyid", temp);
               parent.addChild(data);
             }
           } else if (parser.getName().compareTo("rechamoney") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData data = new ProtocolData("rechamoney", temp);
               parent.addChild(data);
             }
           } else if (parser.getName().compareTo("rechapaymoney") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData data = new ProtocolData("rechapaymoney", temp);
               parent.addChild(data);
             }
           } else if (parser.getName().compareTo("rechamemo") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData data = new ProtocolData("rechamemo", temp);
               parent.addChild(data);
             }
           } else if (parser.getName().compareTo("rechaisdefault") == 0) {
             String temp = parser.nextText();
             if (temp != null && temp.length() > 0) {
               ProtocolData data = new ProtocolData("rechaisdefault", temp);
               parent.addChild(data);
             }
           }
         /**
          * else if (parser.getName().compareTo("feemoney") == 0) { String temp =
          * parser.nextText(); if (temp != null && temp.length() > 0) { ProtocolData data = new
          * ProtocolData("feemoney", temp); parent.addChild(data); } } else if
          * (parser.getName().compareTo("allmoney") == 0) { String temp = parser.nextText(); if
          * (temp != null && temp.length() > 0) { ProtocolData data = new ProtocolData("allmoney",
          * temp); parent.addChild(data); } }else if (parser.getName().compareTo("state") == 0) {
          * String temp = parser.nextText(); if (temp != null && temp.length() > 0) { ProtocolData
          * data = new ProtocolData("state", temp); parent.addChild(data); } }else if
          * (parser.getName().compareTo("huancardbank") == 0) { String temp = parser.nextText(); if
          * (temp != null && temp.length() > 0) { ProtocolData data = new
          * ProtocolData("huancardbank", temp); parent.addChild(data); } }else if
          * (parser.getName().compareTo("fucardbank") == 0) { String temp = parser.nextText(); if
          * (temp != null && temp.length() > 0) { ProtocolData data = new
          * ProtocolData("fucardbank", temp); parent.addChild(data); } }
          */
         }
         break;
       case XmlPullParser.END_TAG:
         {
           if (parser.getName().compareTo("msgchild") == 0) {
             return;
           }
         }
         break;
       case XmlPullParser.TEXT:
         {
         }
         break;
     }
     eventType = parser.next();
   }
   return;
 }