adding writeXML to global.cs for easy conversion to XML