/// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        public override void LoadInput(object obj)
        {
            innerObject = obj;

            Type inputType = obj.GetType();

            Type xmlDocType      = typeof(XmlDocument);
            Type streamType      = typeof(Stream);
            Type xmlReaderType   = typeof(XmlReader);
            Type xmlNodeListType = typeof(XmlNodeList);
            Type xmlNode         = typeof(XmlNode);

            TransformObjectType loadInputType = TransformObjectType.NotSet;

            if (inputType == xmlDocType || inputType.IsSubclassOf(xmlDocType))
            {
                //logger.Debug("LoadInput for XmlDocument");
                loadInputType = TransformObjectType.XmlDocumetType;
            }
            else if (inputType == streamType || inputType.IsSubclassOf(streamType))
            {
                //logger.Debug("LoadInput for Stream");
                loadInputType = TransformObjectType.StreamType;
            }
            else if (inputType == xmlReaderType || inputType.IsSubclassOf(xmlReaderType))
            {
                //logger.Debug("LoadInput for XmlReader");
                loadInputType = TransformObjectType.XmlReaderType;
            }
            else if (inputType == xmlNodeListType || inputType.IsSubclassOf(xmlNodeListType))
            {
                //logger.Debug("LoadInput for XmlNodeList");
                loadInputType = TransformObjectType.XmlNodeListType;
            }
            else if (inputType == xmlNode || inputType.IsSubclassOf(xmlNode))
            {
                //logger.Debug("LoadInput for XmlNode");
                loadInputType = TransformObjectType.XmlNodeType;
            }

            LoadInputObject(obj, loadInputType);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public override object GetOutput(Type type)
        {
            TransformObjectType typeObj = TransformObjectType.NotSet;

            if (type.FullName == typeof(Stream).FullName)
            {
                typeObj = TransformObjectType.StreamType;
            }
            else if (type.FullName == typeof(XmlDocument).FullName)
            {
                typeObj = TransformObjectType.XmlDocumetType;
            }
            else if (type.FullName == typeof(XmlReader).FullName)
            {
                typeObj = TransformObjectType.XmlReaderType;
            }
            else if (type.FullName == typeof(XmlNodeList).FullName)
            {
                typeObj = TransformObjectType.XmlNodeListType;
            }
            else if (type.FullName == typeof(XmlNode).FullName)
            {
                typeObj = TransformObjectType.XmlNodeType;
            }
            else
            {
                typeObj = TransformObjectType.NotSet;
            }

            object result = GetOutputObject(typeObj);

            if (result == null)
            {
                result = innerObject;
            }

            return(result);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="loadInputType"></param>
        private void LoadInputObject(object obj, TransformObjectType loadInputType)
        {
            reader = null;

            switch (loadInputType)
            {
            case TransformObjectType.StreamType:
            {
                typeInputObject = TransformObjectType.StreamType;
                Stream stream = (Stream)obj;

                if (stream != null && stream.Length > 0)
                {
                    reader = XmlReader.Create(stream, GetReaderSettings());
                }

                break;
            }

            case TransformObjectType.XmlDocumetType:
            {
                typeInputObject = TransformObjectType.XmlDocumetType;
                XmlDocument doc = (XmlDocument)obj;

                if (string.IsNullOrEmpty(doc.OuterXml) == false)
                {
                    StringReader stringReaderDoc = new StringReader(doc.OuterXml);
                    reader = XmlReader.Create(stringReaderDoc, GetReaderSettings());
                }

                break;
            }

            case TransformObjectType.XmlNodeListType:
            {
                typeInputObject = TransformObjectType.XmlNodeListType;

                XmlNodeList   list    = (XmlNodeList)obj;
                StringBuilder builder = new StringBuilder();

                foreach (XmlNode tmpNode in list)
                {
                    builder.Append(tmpNode.OuterXml);
                }

                if (!string.IsNullOrEmpty(builder.ToString()))
                {
                    StringReader stringReaderList = new StringReader(builder.ToString());
                    reader = XmlReader.Create(stringReaderList, GetReaderSettings());
                }

                break;
            }

            case TransformObjectType.XmlNodeType:
            {
                typeInputObject = TransformObjectType.XmlNodeType;
                XmlNode node = (XmlNode)obj;

                if (!string.IsNullOrEmpty(node.OuterXml))
                {
                    StringReader stringReaderNode = new StringReader(node.OuterXml);
                    reader = XmlReader.Create(stringReaderNode, GetReaderSettings());
                }

                break;
            }

            case TransformObjectType.XmlReaderType:
            {
                typeInputObject = TransformObjectType.XmlReaderType;
                reader          = (XmlReader)obj;

                break;
            }

            default:
            {
                typeInputObject = TransformObjectType.NotSet;
                throw new NotImplementedException("Метод LoadInputObject вернул ошибку. Неизвестное значение TransformObjectType.");
            }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="typeObj"></param>
        /// <returns></returns>
        private object GetOutputObject(TransformObjectType typeObj)
        {
            //logger.Debug("GetOutputObject");

            if (outputBuilder == null || string.IsNullOrEmpty(outputBuilder.ToString()))
            {
                //logger.Debug("GetOutputObject outputBuilder empty");

                if ((reader == null || reader.EOF) &&
                    (this.Context != null) &&
                    (string.IsNullOrEmpty(this.Context.OuterXml) == false))
                {
                    //logger.Debug("GetOutputObject by Context");
                    XmlNode node = (XmlNode)this.Context;
                    if (string.IsNullOrEmpty(node.OuterXml) == false)
                    {
                        StringReader stringReader = new StringReader(node.OuterXml);
                        reader = XmlReader.Create(stringReader, GetReaderSettings());
                    }
                }

                Process();
            }

            object result = null;

            XmlDocument document = new XmlDocument();

            switch (typeObj)
            {
            case TransformObjectType.StreamType:

                //logger.Debug("GetOutputObject StreamType");
                if (outputMemoryStream != null)
                {
                    try
                    {
                        //logger.Error("GetOutputObject close stream");
                        outputMemoryStream.Close();
                    }
                    catch (Exception ex)
                    {
                        //logger.Error("GetOutputObject close stream error:" + ex.Message);
                    }
                }

                if (outputBytes == null)
                {
                    //logger.Error("GetOutputObject fill outputBytes");
                    outputBytes = Encoding.UTF8.GetBytes(outputBuilder.ToString());
                }

                outputMemoryStream = new MemoryStream(outputBytes);
                result             = outputMemoryStream;

                break;

            case TransformObjectType.XmlDocumetType:

                //logger.Debug("GetOutputObject XmlDocumetType");
                document.LoadXml(outputBuilder.ToString());
                result = document;

                break;

            case TransformObjectType.XmlNodeListType:

                //logger.Debug("GetOutputObject XmlNodeListType");

                if (outputBuilder != null && string.IsNullOrEmpty(outputBuilder.ToString()) == false)
                {
                    document.LoadXml(outputBuilder.ToString());
                }

                result = document.ChildNodes;

                break;

            case TransformObjectType.XmlNodeType:

                //logger.Debug("GetOutputObject XmlNodeType");
                document.LoadXml(outputBuilder.ToString());
                result = document.DocumentElement as XmlNode;

                break;

            case TransformObjectType.XmlReaderType:

                //logger.Debug("GetOutputObject XmlReaderType");
                StringReader strReader = new StringReader(outputBuilder.ToString());
                result = XmlReader.Create(strReader, this.GetReaderSettings());

                break;

            default:
                //logger.Debug("GetOutputObject default");
                break;
            }

            return(result);
        }