sudzc
sudzc copied to clipboard
Soap.m deserialize method can't handle xsi:type ??
- (id) deserialize: (CXMLNode*) element does' not handle elements which have xsi:type but not generic !
try deserialize below line: <ns2:lastInvoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:upcInvoice">
here is fail: NSString* value = [element stringValue]; if ([type rangeOfString:@":"].length > 0) { type = [[type substringFromIndex:[type rangeOfString:@":"].location+1] lowercaseString]; }
[...] here are checks for generic types
and finally we want to return Class or Dictionary: // Return as a dictionary if(value == nil) { NSString* prefix = @""; if([Soap respondsToSelector:@selector(prefix)]) { prefix = [Soap performSelector:@selector(prefix)]; } Class cls = NSClassFromString([NSString stringWithFormat:@"%@%@", prefix, type]); if(cls != nil ) { return [cls newWithNode:element]; } else { return [Soap deserializeAsDictionary:element]; } }
but "value" is not "nil" !!!
what can do ?
maybe: if ( [element children] && [element children].count > 1) { return [Soap deserializeAsDictionary:element]; }
just before last else with:
return value; //we mean that this is string... why ?
??