Parsing SoapObject Responst in android

后端 未结 1 416
死守一世寂寞
死守一世寂寞 2020-12-11 14:07

My code is:

public class MainActivity extends Activity implements OnClickListener {

Button b;
private static String NAMESPACE = \"http://tempuri.org/\";
pri         


        
相关标签:
1条回答
  • 2020-12-11 14:35

    Basicly it's something like this:

    SoapObject GetListResponse = (SoapObject)result.getProperty(0); 
    SoapObject DocumentElement = (SoapObject)GetListResponse.getProperty(3);
    SoapObject Table1 = (SoapObject)DocumentElement.getProperty(0);
    

    This contains SoapObjects within SoapObjects, so the best thing to do is to write a recursive method to scan through all properties and find the information you need. Something like this:

    private static void ScanSoapObject(SoapObject result) 
    {
        for(int i=0;i<result.getPropertyCount();i++)
        {
            if(result.getProperty(i) instanceof SoapObject)
            {               
                 ScanSoapObject((SoapObject)result.getProperty(i));
            }
            else
            {               
                //do something with the current property
    
                //get the current property name:
                PropertyInfo pi = new PropertyInfo();
                result.getPropertyInfo(i,pi);
                String name = pi.getName();
            }
        }
    }
    
    0 讨论(0)
提交回复
热议问题