nested NSDictionary from plist
Posted
by Dror Sabbag
on Stack Overflow
See other posts from Stack Overflow
or by Dror Sabbag
Published on 2010-05-17T10:45:22Z
Indexed on
2010/05/17
10:50 UTC
Read the original article
Hit count: 261
plist
|nsdictionary
Hello,
Here is a question,
i have a plist, with main NSDictoinary, which his keys are dates. for every date, i have NSDictionary which his keys are (let's say) categories every Category holds Keys and values.
I would like to create 2 variables that each one will hold the correct NSDictionary
NSDictionary *dates = ? NSDictionary *Categories = ?
below is my plist, Please help to understand how this should be done.
**Note: i do know how to assign the first dates dictionary from the plist.. just stuck with the Categories.
NSDictionary *dict = [[NSDictionary alloc]initWithContentsOfFile:path];
self.dates = dict;
[dict release];
The plist:
<dict>
<key>2010-05-08</key>
<dict>
<key>Catergory1</key>
<dict>
<key>key1</key>
<string>value1</string>
<key>key2</key>
<string>value2</string>
<key>key3</key>
<string>value3</string>
</dict>
<key>Catergory2</key>
<dict>
<key>key1</key>
<string>value1</string>
<key>key2</key>
<string>value2</string>
<key>key3</key>
<string>value3</string>
</dict>
<key>2010-01-02</key>
<dict>
<key>Catergory1</key>
<dict>
<key>key1</key>
<string>value1</string>
<key>key2</key>
<string>value2</string>
<key>key3</key>
<string>value3</string>
</dict>
<key>Catergory2</key>
<dict>
<key>key1</key>
<string>value1</string>
<key>key2</key>
<string>value2</string>
<key>key3</key>
<string>value3</string>
</dict>
</dict>
</dict>
</plist>
any help would be greatly appriciated, as i searched over the forum history and found nothing which match my scenario.
THANKS!
© Stack Overflow or respective owner