SUDZC を使用して Web サービスに接続しています。元のコードは、応答した値を上書きし続けていました。コードを次のように変更しました。
// Deserializes the element in a dictionary.
+(id)deserializeAsDictionary:(CXMLNode*)element {
if([element childCount] == 1) {
CXMLNode* child = [[element children] objectAtIndex:0];
if([child kind] == CXMLTextKind)
{
// NSLog(@"returnED:%@",[[[element children] objectAtIndex:0] stringValue]);
return [[[element children] objectAtIndex:0] stringValue];
}
}
NSMutableDictionary* d = [NSMutableDictionary dictionary];
for(CXMLNode* child in [element children]) {
id v = [Soap deserialize:child];
if(v == nil) { v = [NSNull null]; }
[d setObject:v forKey:[child name]];
// code added from greg to fix dictionary over writting
NSString* key = [child name];
id check = [d objectForKey:key];
if( check != nil ) {
NSInteger next = 1;
key = [NSString stringWithFormat:@"%@%d", [child name], next];
check = [d objectForKey:key];
while( check != nil ) {
next++;
key = [NSString stringWithFormat:@"%@%d", [child name], next];
check = [d objectForKey:key];
}
[d setObject:v forKey:key];
}
}
return d;
}
ここで、意図した値とともに一連の null 値を受け取ります。
2012-08-02 08:25:22.848 Management[13416:707] TC Keys: {
GetCashiersResult = {
diffgram = {
NewDataSet = {
TC = {
"CSHR_NUM" = 7;
"CSHR_NUM1" = 7;
"CSHR_POS_NAME" = Randy;
"CSHR_POS_NAME1" = Randy;
};
TC1 = {
"CSHR_NUM" = 999;
"CSHR_NUM1" = 999;
"CSHR_POS_NAME" = "Apple Tester";
"CSHR_POS_NAME1" = "Apple Tester";
};
TC2 = {
"CSHR_NUM" = 8;
"CSHR_NUM1" = 8;
"CSHR_POS_NAME" = Jonathan;
"CSHR_POS_NAME1" = Jonathan;
};
TC3 = {
"CSHR_NUM" = 54;
"CSHR_NUM1" = 54;
"CSHR_POS_NAME" = LEXIE;
"CSHR_POS_NAME1" = LEXIE;
};
TC4 = {
"CSHR_NUM" = 7;
"CSHR_NUM1" = 7;
"CSHR_POS_NAME" = Randy;
"CSHR_POS_NAME1" = Randy;
};
};
NewDataSet1 = {
TC = {
"CSHR_NUM" = 7;
"CSHR_NUM1" = 7;
"CSHR_POS_NAME" = Randy;
"CSHR_POS_NAME1" = Randy;
};
TC1 = {
"CSHR_NUM" = 999;
"CSHR_NUM1" = 999;
"CSHR_POS_NAME" = "Apple Tester";
"CSHR_POS_NAME1" = "Apple Tester";
};
TC2 = {
"CSHR_NUM" = 8;
"CSHR_NUM1" = 8;
"CSHR_POS_NAME" = Jonathan;
"CSHR_POS_NAME1" = Jonathan;
};
TC3 = {
"CSHR_NUM" = 54;
"CSHR_NUM1" = 54;
"CSHR_POS_NAME" = LEXIE;
"CSHR_POS_NAME1" = LEXIE;
};
TC4 = {
"CSHR_NUM" = 7;
"CSHR_NUM1" = 7;
"CSHR_POS_NAME" = Randy;
"CSHR_POS_NAME1" = Randy;
};
};
};
diffgram1 = {
NewDataSet = {
TC = {
"CSHR_NUM" = 7;
"CSHR_NUM1" = 7;
"CSHR_POS_NAME" = Randy;
"CSHR_POS_NAME1" = Randy;
};
TC1 = {
"CSHR_NUM" = 999;
"CSHR_NUM1" = 999;
"CSHR_POS_NAME" = "Apple Tester";
"CSHR_POS_NAME1" = "Apple Tester";
};
TC2 = {
"CSHR_NUM" = 8;
"CSHR_NUM1" = 8;
"CSHR_POS_NAME" = Jonathan;
"CSHR_POS_NAME1" = Jonathan;
};
TC3 = {
"CSHR_NUM" = 54;
"CSHR_NUM1" = 54;
"CSHR_POS_NAME" = LEXIE;
"CSHR_POS_NAME1" = LEXIE;
};
TC4 = {
"CSHR_NUM" = 7;
"CSHR_NUM1" = 7;
"CSHR_POS_NAME" = Randy;
"CSHR_POS_NAME1" = Randy;
};
};
NewDataSet1 = {
TC = {
"CSHR_NUM" = 7;
"CSHR_NUM1" = 7;
"CSHR_POS_NAME" = Randy;
"CSHR_POS_NAME1" = Randy;
};
TC1 = {
"CSHR_NUM" = 999;
"CSHR_NUM1" = 999;
"CSHR_POS_NAME" = "Apple Tester";
"CSHR_POS_NAME1" = "Apple Tester";
};
TC2 = {
"CSHR_NUM" = 8;
"CSHR_NUM1" = 8;
"CSHR_POS_NAME" = Jonathan;
"CSHR_POS_NAME1" = Jonathan;
};
TC3 = {
"CSHR_NUM" = 54;
"CSHR_NUM1" = 54;
"CSHR_POS_NAME" = LEXIE;
"CSHR_POS_NAME1" = LEXIE;
};
TC4 = {
"CSHR_NUM" = 7;
"CSHR_NUM1" = 7;
"CSHR_POS_NAME" = Randy;
"CSHR_POS_NAME1" = Randy;
};
};
};
schema = {
element = {
complexType = {
choice = {
element = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
element1 = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
};
choice1 = {
element = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
element1 = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
};
};
complexType1 = {
choice = {
element = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
element1 = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
};
choice1 = {
element = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
element1 = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
};
};
};
element1 = {
complexType = {
choice = {
element = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
element1 = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
};
choice1 = {
element = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
element1 = {
complexType = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
complexType1 = {
sequence = {
element = 0;
element1 = "<null>";
element2 = 0;
};
sequence1 = {
element = 0;
element1 = "<null>";
element2 = 0;
};
};
};
};
};
};
};
データを複数回プルして、すべての ? をプルするのを止めることはできません。子が 1 でない場合、コードは停止するべきではありませんか?