Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soap.m deserialize method can't handle xsi:type ?? #9

Open
ghost opened this issue Aug 22, 2012 · 0 comments
Open

Soap.m deserialize method can't handle xsi:type ?? #9

ghost opened this issue Aug 22, 2012 · 0 comments

Comments

@ghost
Copy link

ghost commented Aug 22, 2012

  • (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 ?

??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants