Do you have an XSD for your CCDA XML format? If so you can use the XML Schema Wizard to create the Cache classes that represent your XML Data. Then just read the data from your global into the generated classes and export to XML. I have done this many times for complicated medical data and it works very reliably.