//---------------------------------------------------------------------------------------//
        private string ConvertToXml(ResultsInfo[] resultsInfoArray)
        {
            const string STRLOG_MethodName = "ConvertToXml";

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName);

            //
            // Catch all exceptions thrown and return an empty string if an error occurred
            //
            XmlDocument xmlDocument = null;
            string xmlExperimentResults = string.Empty;
            try
            {
                //
                // Check that the experiment info array exists
                //
                if (resultsInfoArray == null)
                {
                    throw new ArgumentNullException(STRERR_ResultsInfoArrayIsNull);
                }

                //
                // Take the experiment info  and put into the XML document
                //
                for (int i = 0; i < resultsInfoArray.GetLength(0); i++)
                {
                    ResultsInfo resultsInfo = resultsInfoArray[i];

                    // Load experiment results XML template string
                    XmlDocument xmlTemplateDocument = XmlUtilities.GetXmlDocument(STRXMLDOC_XmlTemplate);

                    //
                    // Fill in the XML template with values from the experiment results information
                    //
                    XmlNode xmlRootNode = XmlUtilities.GetXmlRootNode(xmlTemplateDocument, STRXML_experimentResults);
                    XmlNode xmlNode = XmlUtilities.GetXmlNode(xmlRootNode, STRXML_experimentResult);
                    XmlUtilities.SetXmlValue(xmlNode, Consts.STRXML_experimentID, resultsInfo.experimentId);
                    XmlUtilities.SetXmlValue(xmlNode, Consts.STRXML_sbName, resultsInfo.sbName, false);
                    XmlUtilities.SetXmlValue(xmlNode, STRXML_userGroup, resultsInfo.userGroup, false);
                    XmlUtilities.SetXmlValue(xmlNode, STRXML_priorityHint, resultsInfo.priorityHint);
                    XmlUtilities.SetXmlValue(xmlNode, STRXML_statusCode, resultsInfo.statusCode);
                    XmlUtilities.SetXmlValue(xmlNode, STRXML_xmlExperimentResult, resultsInfo.xmlExperimentResult, true);
                    XmlUtilities.SetXmlValue(xmlNode, STRXML_xmlResultExtension, resultsInfo.xmlResultExtension, true);
                    XmlUtilities.SetXmlValue(xmlNode, STRXML_xmlBlobExtension, resultsInfo.xmlBlobExtension, true);
                    XmlNode xmlNodeTemp = XmlUtilities.GetXmlNode(xmlNode, STRXML_warningMessages);
                    XmlUtilities.SetXmlValues(xmlNodeTemp, STRXML_warningMessage, resultsInfo.warningMessages, true);
                    XmlUtilities.SetXmlValue(xmlNode, STRXML_errorMessage, resultsInfo.errorMessage, true);

                    if (xmlDocument == null)
                    {
                        xmlDocument = xmlTemplateDocument;
                    }
                    else
                    {
                        //
                        // Create an XML fragment from the XML template and append to the document
                        //
                        XmlDocumentFragment xmlFragment = xmlDocument.CreateDocumentFragment();
                        xmlFragment.InnerXml = xmlNode.OuterXml;
                        xmlDocument.DocumentElement.AppendChild(xmlFragment);
                    }
                }

                //
                // Check if there were any experiment statistics
                //
                if (xmlDocument == null)
                {
                    xmlDocument = XmlUtilities.GetXmlDocument(STRXMLDOC_XmlTemplate);
                    XmlNode xmlRootNode = XmlUtilities.GetXmlRootNode(xmlDocument, STRXML_experimentResults);
                    XmlNode xmlNode = XmlUtilities.GetXmlNode(xmlRootNode, STRXML_experimentResult);
                    xmlRootNode.RemoveChild(xmlNode);
                }

                //
                // Convert the XML document to a string
                //
                StringWriter sw = new StringWriter();
                XmlTextWriter xtw = new XmlTextWriter(sw);
                xtw.Formatting = Formatting.Indented;
                xmlDocument.WriteTo(xtw);
                xtw.Flush();
                xmlExperimentResults = sw.ToString();
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
            }

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName);

            return xmlExperimentResults;
        }