Based on the UI dialog for Export XML, it looks like you'll first want to set an XMLExportPreference to copy either optimized or formatted images, and then choose and image type. So,
objDoc.xmlExportPreferences.copyFormattedImages = true;
objDoc.xmlExportPreferences.copyOptimizedImages = true;
objDoc.xmlExportPreferences.imageConversion = ImageConversion.JPEG
objDoc.xmlExportPreferences.imageConversion = ImageConversion.PNG
This help page describes the difference between optimized and formatted images: InDesign Help | Exporting XML
That should get you started. You may need to play with some other options to get the output you want, but that's the idea.
And this will also convert .ai? I thought it might be a little difficult for vector bassed graphics. Thank you, sir!
I don't have any AI images to test with, but it works for EPS so I would think so.