我需要帮助来解析数据响应。当我向 Web 服务发送参数时,Web 服务将提供数据作为响应,我使用的是 wsdl2objc
for( ; cur != NULL ; cur = cur->next) {
if(cur->type == XML_ELEMENT_NODE) {
if(xmlStrEqual(cur->name, (const xmlChar *) "Body")) {
NSMutableArray *responseBodyParts = [NSMutableArray array];
xmlNodePtr bodyNode;
for(bodyNode=cur->children ; bodyNode != NULL ; bodyNode = bodyNode->next) {
if(cur->type == XML_ELEMENT_NODE) {
if(xmlStrEqual(bodyNode->name, (const xmlChar *) "selectDataReturn")) {
NSString *bodyObject = [NSString deserializeNode:bodyNode];
if (bodyObject != nil) [responseBodyParts addObject:bodyObject];
}
if (xmlStrEqual(bodyNode->ns->prefix, cur->ns->prefix) &&
xmlStrEqual(bodyNode->name, (const xmlChar *) "Fault")) {
SOAPFault *bodyObject = [SOAPFault deserializeNode:bodyNode];
if (bodyObject != nil) [responseBodyParts addObject:bodyObject];
}
}
}
response.bodyParts = responseBodyParts;
//bodyParts is my data.
}
}
}
但我的 bodyParts 回复我:
<?xml version='1.0' encoding='UTF-8'?><EISDataRS><EISDataRecord><RECSEQ>1</RECSEQ><INPUT_DATE>201201</INPUT_DATE><PREFIX_BU>AAA</PREFIX_BU><INDEX_LEVEL>10000</INDEX_LEVEL><CF>83.94</CF></EISDataRecord><EISDataRecord><RECSEQ>2</RECSEQ><INPUT_DATE>201201</INPUT_DATE><PREFIX_BU>AAA</PREFIX_BU><INDEX_LEVEL>20100</INDEX_LEVEL><CF>73.94</CF></EISDataRecord><EISDataRecord><RECSEQ>1</RECSEQ><INPUT_DATE>201201</INPUT_DATE><PREFIX_BU>AAA</PREFIX_BU><INDEX_LEVEL>22100</INDEX_LEVEL><CF>57.44</CF></EISDataRecord></EISDataRS>
我如何解析 wsdl2objc 中的数据或者我应该如何解析视图控制器中的 resp.bodyParts 我只需要文本数据请指教。谢谢。