forked from bcaccinolo/XML-to-NSDictionary
-
Notifications
You must be signed in to change notification settings - Fork 1
an iPhone XML to NSDictionary converter
License
cbpowell/XML-to-NSDictionary
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The key ideas: 1 XML elements map to key names in the dictionary 2 Each element corresponds to a child dictionary 3 Attribute key-value pairs are added to the element’s child dictionary 4 Strings from text nodes are assigned to the child dictionary’s “text” key 5 If an element name is encountered multiple times, the value of the element is set to an array of children dictionaries ----Additions to NSDictionary---- The retrieveForPath: method allows easy selection of items in a nested NSDictionary structure, using a string in the familar dot syntax. Items in NSArrays inside the hierarchy can also be moved through using object indexes, or by using "last" to get the last object in the array. For example, the following nested NSDictionary: NSDictionary *exampleDict = { results = { example1 = { hash = 4H5keM; string1 = "foo"; string2 = "bar"; userDetails = { { firstName = "John"; lastName = "Smith"; userName = "JSmith"; userID = 12345; }, { firstName = "Jane"; lastName = "Doe"; userName = "JDoe"; userID = 54321; }, }; }; }; statusCode = OK; } The firstName of Jane's record can be quickly accessed by using: [exampleDict retrieveForPath:@"results.example1.userDetails.last.firstName"]; The firstName of John's record can be quickly accessed by using: [exampleDict retrieveForPath:@"results.example1.userDetails.0.firstName"]; Unfortunately NSArrays in the heirarchy seriously obfuscates the NSDictionary structure, and you'll have to know the index of the item you want when NSArrays appears.
About
an iPhone XML to NSDictionary converter
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Objective-C 90.9%
- C 9.1%