I have a material library files (mat) and want to export all materials names in this library to a xml file in this form:

where "ABC" is the material name in this library.
so how to do that or is there any script can do this task?
Thanks in Advanced.