The following sample Plist file is used for my question below.
<?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>firstDictionary</key>
<dict>
<key>string</key>
<string>someText</string>
<key>anArray</key>
<array>
<string>first</string>
<string>second</string>
</array>
</dict>
<key>secondDictionary</key>
<dict>
<key>subDictionary</key>
<dict>
<key>aBoolValue</key>
<false/>
</dict>
</dict>
</dict>
</plist>
So my question is, since this is a Plist (working with XCode), all keys have the element name <key>
and the values can be , , etc... The Key-value pair are always side-by-side (direct siblings)..
Is there a way using XQuery produce the value for a key? Like say retuenValueForKey(secondDictionary) to produce the following?
<dict>
<key>subDictionary</key>
<dict>
<key>aBoolValue</key>
<false/>
</dict>
</dict>
My main reference so far is this link from W3Schools, but I could not get it working correctly.