I found in our blogs a document "XI: Mapping Tool Exports".
Well, there is much simpler way to do that, actually.
1 Put a cursor on the "description" field of the Message Mapping object. 2 Press CTRL+SHIFT+0
You have additional window with import/export buttons and additional information about the message mapping.
You can also download the generated java source if you want to see it.
This feature is available since XI30 SP9, since XI30 SP14 a new button was addded "import mapping without source and target structures". The thing is that after import the mapping uses structures that were imported from the XIM file and not original ones. Importing mapping "without structures" cause the tool to load only the transformation description and testcases whithout touching anything else.