I understand from the comments that the OP likes the output from the linked code but would like the information placed into an xml file that can be queried.
Her'es how to modify the script given at Get contents of .desktop files to process the output into an XML file.
filename="MyDesktopFiles.xml"
rm $filename
touch $filename
echo '<?xml version="1.0"?>' >> $filename
echo '<items>' >> $filename
for files in /usr/share/applications/*.desktop;
do
echo '<item>' >> $filename
echo ' <name>'$(grep -e "^Name=" $files | sed 's/Name=//g')'</name>' >> $filename
echo ' <command>'$(grep -e "^Exec=" $files | sed 's/Exec=//g')'</command>' >> $filename
echo '</item>' >> $filename
done
echo '</items>' >> $filename
echo '</xml>' >> $filename
.desktopfiles? So these should be in/usr/share/applicationsor in~/.local/share/applications? So would you really need a.xmlfile for your purpose? – Feb 06 '13 at 11:13/usr/share/applicationsI can't get the "keywords" used to execute the applications. – Zignd Feb 06 '13 at 11:20.desktopfiles have more than one pair of Name+Exec and when that's not in proper order, there's confusion. I mentioned the LibreOffice.desktopfiles in this context. Perhaps someone who is good at this stuff may be able to help you! – Feb 06 '13 at 11:48