Toxic Software (Blog): mdfind2 with XML output from spotlight searches
"mdfind2 is a replacement for Apple’s mdfind command line tool. This version adds one feature that mdfind doesn’t have, you can specify the --xml switch on the command-line to output the results (including full attribute values) in XML."