Reputation: 57
I know how to grab hold of the actual values of name, monsterLevel and monsterQueue deep dug into "World 1" > "Act 1" > "Dungeon 1" but I can't seem to figure out how to return the text "World 1" from in-between the <key>
of my <dict>
.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>World 1</key>
<dict>
<key>Act 1</key>
<dict>
<key>Dungeon 1</key>
<dict>
<key>name</key>
<string>d1name</string>
<key>monsterLevel</key>
<string>1</string>
<key>monsterQueue</key>
<string>0;0;0;0</string>
</dict>
<key>Dungeon 2</key>
<dict>
<key>name</key>
<string>d2name</string>
<key>monsterLevel</key>
<string>2</string>
<key>monsterQueue</key>
<string>1;1;1;1</string>
</dict>
</dict>
</dict>
</dict>
Upvotes: 1
Views: 186
Reputation: 26395
It sounds like you want the string contained in the key? If so, you can get the keys of a dictionary using:
NSArray* keys = [myDictionary allKeys];
or, if you only want keys for a particular object, you can use:
NSArray* keys = [myDictionary allKeysForObject:someObject];
Upvotes: 3