如何从值加载数组?

时间:2012-04-18 13:28:50

标签: iphone objective-c ios5 sudzc

我很抱歉提出新手问题。我已经工作了好几天了,而且我有理解问题。我使用sudzc来帮助连接到我的Web服务。示例函数仅返回1个结果(最后一个)。如何将所有结果加载到数组中,以便找到CSHR_NUM = 8?我不确定是否有问题:      - (void)GetCashiersHandler:(id)value

非常感谢任何帮助!

sudzc日志记录返回(有数百个条目,我将其删除):

<TC diffgr:id="TC1" msdata:rowOrder="0">
 <CSHR_POS_NAME>JACKSON<CSHR_POS_NAME />
  <CSHR_NUM>8</CSHR_NUM>
</TC>
<TC diffgr:id="TC2" msdata:rowOrder="1"> 
 <CSHR_POS_NAME>ALISON</CSHR_POS_NAME> 
  <CSHR_NUM>464</CSHR_NUM>
</TC> 

我使用调用的示例方法:

[service GetCashiers:self action:@selector(GetCashiersHandler);

// Handle the response from GetCashiers to get login in name.
- (void) GetCashiersHandler: (id) value
  {
// Do something with the CXMLNode* result
 CXMLNode *result = (CXMLNode*)value;

 NSLog(@"I returned the value: %@", result);

  }

NSLog结果:

I returned the value: {
 GetCashiersResult = {
diffgram = {
NewDataSet = {
TC = {
  "CSHR_NUM" = 464;
    "CSHR_POS_NAME" = ALLISON;
      };
   };
};
schema = {
  element = {
    complexType = {
   choice = {
  element = {
    complexType = {
  sequence = {
  element = 0;
        };
      };
    };
   };
   };
  };
 };
 };
} 

1 个答案:

答案 0 :(得分:0)

NSMutableArray * myData = [[NSMutableArray alloc] initWithCapacity:5];

// loop over items to add and add them with

[myData addObject:myItem];