Export xml

Ready for merge.

I had to merge the code in Normalize manually.