private void ProcessUploadedXML(XmlElement node)
        {
            bool rspNode = true;

            foreach (XmlNode child in node.ChildNodes)
            {
                if (child is XmlElement)
                {
                    rspNode = false;
                    ProcessUploadedXML((XmlElement)child);
                }
            }

            if (rspNode)
            {
                string        tagName = node.Name;
                List <string> itemVariableIdentifiers = RamsellExport.GetItemVariableIdentifiersForRamsellTagName(tagName);
                string        allIdentifiers          = String.Join(", ", itemVariableIdentifiers.ToArray());
                string        rspVal = node.InnerText;
                Debug.WriteLine("ProcessUploadedXML:\n\ttag \"{0}\" -> itemVariable(s) \"{1}\"\n\tvalue \"{2}\"",
                                tagName, allIdentifiers, rspVal);
            }
        }
        public ActionResult TestRamsellXMLExport(int?formResultId = null)
        {
            // find an ADAP assessment to export
            if (formResultId == null)
            {
                int formId = formsRepo.GetFormByIdentifier("ADAP").formId;
                formResultId = formsRepo.GetFormResultsByFormId(formId).First().formResultId;
            }
            Debug.WriteLine("* * *  TestRamsellXmlExport formResultId: " + formResultId.ToString());

            XmlDocument outputXmlDoc = RamsellExport.BuildRamsellXmlDocForFormResult(formResultId.Value, formsRepo);

            // stream result xml with line breaks and indents
            StringBuilder sbOut = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(sbOut, Utilities.xmlWriterSettings))
            {
                outputXmlDoc.Save(writer);
            }

            FileContentResult fcr = File(Encoding.ASCII.GetBytes(sbOut.ToString()), "text/plain", "result.xml");

            return(fcr);
        }