-
Notifications
You must be signed in to change notification settings - Fork 235
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
support duplicated tags? #27
Comments
The problem is down to the structure of the XML. XMLDictionary handles multiple nodes with the same name - the problem here is that they have different structures. For the first When you use the @"person.age.china" key path, it attempts to return an array containing the china property of both age nodes, but since the second age node is just a string, and doesn't have a china subnode, it crashes. I can probably add some protection in the code for this scenario, but for now you can fix it by setting:
Before parsing the XML. |
Note: if you want to retrieve an array of values for all person nodes, not just the first one, use this instead:
|
@nicklockwood is this library supports below format : |
i have a xml file like that:
when i use like below:
NSDictionary *personXml=[NSDictionary dictionaryWithXMLFile:xmlFilePath];
NSLog(@"personXml: %@", personXml);
NSLog(@"path value[%@]",[personXml stringValueForKeyPath:@"person.age.china"]);
it generate a NSUnknownKeyException:
2014-10-26 14:39:07.098 XMLTest[1215:70b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSCFString 0xeb1f660> valueForUndefinedKey:]: this class is not key value coding-compliant for the key china.
i think it should be a duplicated tags problem, is it right?
The text was updated successfully, but these errors were encountered: