Blender rna_xml serialize node_trees and import
After studying the source code of that module I realized that it is unable to create new Node objects since it only assigns attributes to pre-existing structures. 

I decided to get around that problem by having a collection of materials in another scene in the same .blend file. Hacky as hell but it works.