ksoap2 이용한 xml 파싱

SOAP 2012. 3. 5. 19:55

ex)

anyType{
  ErrorCode=0;
   Xml=anyType{
    DrugInfo=anyType{
     DIK_INFO=anyType{
     BOH_CODE=648502080;
     SUNB_NAME_NEW=세프라딘수화물;
     SUNB_ENAME_NEW=Cephradine Hydrate;
     DRUG_NAME=신풍세프라딘캡슐;
     PROD_ETC_IMAGE=http://www.pharm.or.kr/images/sb_photo/big3/A11A0030A021202.jpg;
     CLASS=전문;
     CLS_NAME=주로 그람양성, 음성균에 작용하는 것;
     PROD_INGREDIENT=세프라딘수화물 500
.
.
.
.



형태라면


   SoapObject so = (SoapObject) envelope.getResponse();
   Log.v("ub", "[DrugInfoManage.java] so.getPropertyCount()   " + so.getPropertyCount());
   Log.v("ub", "[DrugInfoManage.java] so.getAttributeCount()   " + so.getAttributeCount());
   Log.v("ub", "[DrugInfoManage.java] so.equals(SUNB_NAME_NEW)  " + so.equals("SUNB_NAME_NEW"));
   Log.v("ub", "[DrugInfoManage.java] so.getProperty(0)  " + so.getProperty(0));
   Log.v("ub", "[DrugInfoManage.java] so.getProperty(1) " + so.getProperty(1));
   // 첫번째
   // anyType{ ErrorCode=0; Xml=anyType
   SoapObject one_anyType = (SoapObject) so.getProperty(1);
   Log.v("ub", "[DrugInfoManage.java] one_anyType.getName()   " + one_anyType.getName());

   Log.v("ub", "[DrugInfoManage.java] one_anyType.getPropertyCount()  " + one_anyType.getPropertyCount());

   //두번째배열
   SoapObject two_anyType = (SoapObject) one_anyType.getProperty(0);
   Log.v("ub", "[DrugInfoManage.java] two_anyType.getName()   " + two_anyType.getName());
   Log.v("ub", "[DrugInfoManage.java] two_anyType.getPropertyCount()  " + two_anyType.getPropertyCount());
   //셋째 배열
   SoapObject three_anyType = (SoapObject) two_anyType.getProperty(0);
   Log.v("ub", "[DrugInfoManage.java] three_anyType.getName()   =" + three_anyType.getName());
   Log.v("ub", "[DrugInfoManage.java] three_anyType.getPropertyCount()  " + three_anyType.getPropertyCount());

   Log.i("ub", "[DrugInfoManage.java] BOH_CODE  =" + three_anyType.getProperty("BOH_CODE"));
   Log.i("ub", "[DrugInfoManage.java] SUNB_NAME_NEW  =" + three_anyType.getProperty("SUNB_NAME_NEW"));
   Log.i("ub", "[DrugInfoManage.java] SUNB_ENAME_NEW  =" + three_anyType.getProperty("SUNB_ENAME_NEW"));
   Log.i("ub", "[DrugInfoManage.java] DRUG_NAME  =" + three_anyType.getProperty("DRUG_NAME"));
   Log.i("ub", "[DrugInfoManage.java] PROD_ETC_IMAGE  =" + three_anyType.getProperty("PROD_ETC_IMAGE"));
   Log.i("ub", "[DrugInfoManage.java] CLASS  =" + three_anyType.getProperty("CLASS"));
   Log.i("ub", "[DrugInfoManage.java] CLS_NAME  =" + three_anyType.getProperty("CLS_NAME"));
   Log.i("ub", "[DrugInfoManage.java] PROD_INGREDIENT  =" + three_anyType.getProperty("PROD_INGREDIENT"));
   Log.i("ub", "[DrugInfoManage.java] CHARACT  =" + three_anyType.getProperty("CHARACT"));
   Log.i("ub", "[DrugInfoManage.java] EFFECT  =" + three_anyType.getProperty("EFFECT"));
   Log.i("ub", "[DrugInfoManage.java] DOSAGE  =" + three_anyType.getProperty("DOSAGE"));
   Log.i("ub", "[DrugInfoManage.java] CAUTION  =" + three_anyType.getProperty("CAUTION"));
   Log.i("ub", "[DrugInfoManage.java] MEDI_GUIDE  =" + three_anyType.getProperty("MEDI_GUIDE"));
   Log.i("ub", "[DrugInfoManage.java] STMT  =" + three_anyType.getProperty("STMT"));

'SOAP' 카테고리의 다른 글

Soap 통신  (0) 2011.12.08
SOAP - 원활한 통신 프로토콜  (0) 2011.12.08
Posted by 요지
,