BSky.Statistics.R.RService.EvaluateToXml C# (CSharp) Method

EvaluateToXml() public method

public EvaluateToXml ( string commandString ) : XmlDocument
commandString string
return System.Xml.XmlDocument
        public XmlDocument EvaluateToXml(string commandString)
        {
            XmlDocument returnValue;
            try
            {
                //16Apr2013///
                bool batchcommand = false;

                try
                {
                    if (!batchcommand)
                    {

                        bool runit = true;
                        if(runit)
                        this._RServer.Evaluate("tmp<-" + commandString); // executing R Command with no left-hand var
                    }
                    else
                        this._RServer.Evaluate(commandString);///16Apr2013 for commands like a<-somfun(..) and b = some expr. left hand var exists.
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error executing:\n"+commandString+"\n" + ex.Message, "R Syntax Execution Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    logService.WriteToLogLevel("Could not execute:\n " + commandString , LogLevelEnum.Error);
                    return null;
                }
            }
            catch (Exception e)
            {
                string errm = "RDotNet: Error message not implemented";// this._RServer.GetErrorText();
                logService.WriteToLogLevel("Could not execute: < " + commandString + " >", LogLevelEnum.Error);
            }
            if (false)//this._RServer.GetErrorText() != RCommandReturn.Success)
            {
                returnValue = null; // new ResultDataItem("Error: " + this._RServer.GetErrorText());

            }
            else if (!Conversions.ToBoolean(this._RServer.Evaluate("is.null(tmp)").AsLogical()[0]))
            {
                returnValue = ParseToXmlDocument("tmp");
            }
            else
            {
                returnValue = null; // new ResultDataItem("No Result - Check Command");
            }

            return returnValue;
        }