如何使用name标签解析Options标记,并将我的arraylist make解析为此类型
[[anyType{}],[Sandy,Mark,Tayler,Waine],[mark Henry]]
FetchFormResponse
{
FetchFormResult=anyType
{
Formlist=anyType
{
Form=anyType
{
Name=Form; Id=6; Options=anyType{};
};
Form=anyType
{
Name=Form1; Id=7;
Options=anyType
{
Option=anyType{Name=Sandy; Id=154; Type=TextBox; Value=anyType{};
};
Option=anyType
{
Name=Mark; Id=155; Type=TextBox; Value=anyType{};
};
Option=anyType
{
Name=Tayler; Id=156; Type=TextArea; Value=anyType{};
};
Option=anyType
{
Name=Waine; Id=157; Type=CheckBox; Value=Master,Graduate;
};
};
Form=anyType
{
Name=Form2; Id=9;
Options=anyType
{
Option=anyType
{
Name=Mark Henry; Id=185; Type=Checkbox; Value=anyType{};
};
};
};
};
};
};
}
知道是否有人解决了这个问题以及如何解决这个问题会很酷。感谢。
答案 0 :(得分:1)
您必须创建soap对象并从中获取响应,例如:
SoapObject response= (SoapObject) envelope.bodyIn;
SoapObject result= (SoapObject) response.getProperty(0);
SoapObject list= (SoapObject) result.getProperty(0);
SoapObject form= (SoapObject) list.getProperty(0);
SoapObject options= (SoapObject) form.getProperty("Options");
for(int i=0; i<options.getPropertyCount(); i++){
SoapObject option= (SoapObject) options.getProperty(i);
String name = option.getPropertyAsString("Name");
array.add(name);
}
这应该有效
答案 1 :(得分:0)
我真的不知道这是否会对你有帮助,因为这是在KSoap中你的看起来像JASON。因为我使用基本的java操作它不会有任何差异
以字符串形式获取结果并使用模式匹配来提取所需的数据
String r = NameArray.columncount("userid", limitstart, loadNumber,loggername);
String temp = r.replaceAll(";\\s", ",").replaceAll("string=", " ")
.replace("anyType{", "").replace(",}", "");
String[] fulname = temp.split(",\\s+");
有关分步说明,请参阅此网站How to process an array returned from WSDL