.1 working version of XML write constructors
messy and not yet complete!