How does QGIS want that XML to be structured?What should its contents be?
If you have an example of that you could use the XMLTemplater to build the XML the hard way, for specific purposes like this that's probably best, the standard XML writer will take what it gets as input and put that in XML, but if you need specific and strict schema's it may not be sufficient.
I'm also wondering if there isn't an easier way to achieve this.Can QGIS use SVG symbols?