Save custom materials to gdml

I have been worked with my own materials for a while. Can i transport them to gdml format and bind to geometry out of there?Or the only way is binding by code?

For example one of probable solutions(i guess): there is persistency worked with gdml. There is material writer, but it saves in xml format. Can i just copy it into a gdml file and hope to run it?