How can I use Xpath to only select the all dict's that contain genre?
<dict>
<key>genre</key><string>News</string>
<key>genreId</key><integer>6009</integer>
</dict>
<dict>
<key>fieldID</key><integer>2</integer>
</dict>
How can I use Xpath to only select the all dict's that contain genre?
<dict>
<key>genre</key><string>News</string>
<key>genreId</key><integer>6009</integer>
</dict>
<dict>
<key>fieldID</key><integer>2</integer>
</dict>
Before your edit:
You can use the function position()
//dict[ position() = 1 ]
or short version
//dict[ 1 ]
After your edit:
//dict[key = 'genre']
returns all dict
elements which have the element key
equal to 'genre'