I have a .plist XML file that looks like:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>system-entities</key>
<array>
<dict>
<key>content-hint</key>
<string>Linux</string>
<key>dev-entry</key>
<string>/dev/disk5s2</string>
<key>mount-point</key>
<string>/Volumes/rootfs</string>
<key>potentially-mountable</key>
<true/>
<key>unmapped-content-hint</key>
<string>Linux</string>
<key>volume-kind</key>
<string>ufsd_ExtFS</string>
</dict>
<dict>
<key>content-hint</key>
<string>Windows_FAT_32</string>
<key>dev-entry</key>
<string>/dev/disk5s1</string>
<key>mount-point</key>
<string>/Volumes/bootfs 1</string>
<key>potentially-mountable</key>
<true/>
<key>unmapped-content-hint</key>
<string>Windows_FAT_32</string>
<key>volume-kind</key>
<string>msdos</string>
</dict>
<dict>
<key>content-hint</key>
<string>FDisk_partition_scheme</string>
<key>dev-entry</key>
<string>/dev/disk5</string>
<key>potentially-mountable</key>
<false/>
<key>unmapped-content-hint</key>
<string>FDisk_partition_scheme</string>
</dict>
</array>
</dict>
</plist>
I want to search the with the content-hint following sibling Windows_FAT_32 and return the mount-point following sibling /Volumes/bootfs 1.
ie. return the "mount point" for the "Windows_FAT_32" partition.
Since this is in a shell script, I've been using xpath...
xpath "//dict/array/dict[string='Windows_FAT_32']/key[.='mount-point']/following-sibling::string[1]/text()"
...which is returning nothing.
My lack of experience with xpath searching has me stuck. I was thinking it may have to be done in 2 steps, one to select the right dict, and a second to extract the mount-point, but I'm still stuck with the selection of the dict match.
Does anyone know how this can be done?