It is an amazing tool. I really appreciate your time to write such a great thing. It rocks man.
Just in case that can be useful for somebody else: I wanted to read my xml file as structure into MATLAB and then, change some data in that structure and finally, write back the structure into new xml file. But I had the problem and it was that the configuration of input xml file was different from output xml file configuration even if I didn't touch structure. What you should do to avoid this problem is doing following:
var = xml_read ('my_file.xml');
work with "var" and change whatever you want.
wPref.StructItem = false;
xml_write('my_file_new.xml', var, 'XXX',wPref);
I got "my_file_new.xml" with the same structure and configuration of "my_file.xml".