///// <summary>
        ///// 获取DynamicX属性名对应的列名
        ///// </summary>
        ///// <param name="view"></param>
        ///// <param name="keyName"></param>
        ///// <returns></returns>
        //private string GetColumnNameFromDynamicX(Domains.DataView view, string keyName)
        //{
        //    if (view == null)
        //    {
        //        return keyName;
        //    }
        //    for (int i = 0; i < view.DataViewCollections.Count; i++)
        //    {
        //        var item = view.DataViewCollections[i].FirstOrDefault(s => s.Code == keyName);
        //        if (item != null)
        //        {
        //            return item.Name;
        //        }
        //    }
        //    return keyName;
        //}
        /// <summary>
        /// 根据普通节点生成xml
        /// </summary>
        /// <param name="xmldoc"></param>
        /// <param name="dataList"></param>
        /// <param name="current"></param>
        /// <param name="lstBcpNodes"></param>
        private void CreateXmlTreeNodeFromSampleSource(XmlDocument xmldoc, SimpleDataSource dataSource, DataParsePluginInfo pluginInfo, XmlNode current, List <BcpNode> lstBcpNodes)
        {
            var dataList = dataSource.Items;

            if (dataList.Count == 0)
            {
                return;
            }

            XmlNode      xmlnode = xmldoc.CreateElement("node");
            XmlAttribute attr    = xmldoc.CreateAttribute("text");

            attr.Value = "root";
            xmlnode.Attributes.Append(attr);
            current.AppendChild(xmlnode);

            DataTable dt = null;

            var atts = DisplayAttributeHelper.FindDisplayAttributes((Type)dataSource.Type);

            if (atts.IsValid())
            {
                dt = new DataTable();
                dt.Columns.Add("I050008");
                foreach (var a in atts)
                {
                    dt.Columns.Add(a.Text);
                }

                foreach (var data in dataList.View)
                {
                    DataRow dr = dt.NewRow();
                    foreach (var a in atts)
                    {
                        dr[a.Text] = a.GetValue(data);
                    }
                    dt.Rows.Add(dr);
                }
            }
            else
            {
                //dt = new DataTable();
                //dt.Columns.Add("I050008");
                //foreach (var model in dataList.View)
                //{
                //    var info = model as DynamicEx;
                //    foreach (var pair in info.Members)
                //    {
                //        if (pair.Key != "XLYLogString")
                //        {
                //            string key = GetColumnNameFromDynamicX(view, pair.Key);
                //            if (!dt.Columns.Contains(key))
                //                dt.Columns.Add(key);
                //        }
                //    }
                //    DataRow dr = dt.NewRow();
                //    foreach (var pair in info.Members)
                //    {
                //        if (pair.Key != "XLYLogString")
                //        {
                //            string key = GetColumnNameFromDynamicX(view, pair.Key);
                //            dr[key] = pair.Value == null ? string.Empty : pair.Value.ToString();
                //        }
                //    }
                //    dt.Rows.Add(dr);
                //}
            }

            BcpNode bcpNode = new BcpNode()
            {
                DataTable = dt, TreeNode = null, XmlNode = xmlnode
            };

            lstBcpNodes.Add(bcpNode);
        }
        /// <summary>
        /// 根据树形节点生成xml
        /// </summary>
        /// <param name="xmldoc"></param>
        /// <param name="nodes"></param>
        /// <param name="current"></param>
        /// <param name="lstBcpNodes"></param>
        private void CreateXmlTreeNodeFromTreeSource(XmlDocument xmldoc, List <TreeNode> nodes, DataParsePluginInfo pluginInfo, XmlNode current, List <BcpNode> lstBcpNodes)
        {
            if (nodes.IsValid())
            {
                foreach (var n in nodes)
                {
                    XmlNode      xmlnode = xmldoc.CreateElement("node"); //因为xml节点中不能包含特殊字符(如空格),所以节点定义格式为<node text="我的 好友">
                    XmlAttribute attr    = xmldoc.CreateAttribute("text");
                    attr.Value = n.Text;
                    xmlnode.Attributes.Append(attr);
                    current.AppendChild(xmlnode);

                    DataTable dt = null;
                    if (n.Total > 0)
                    {
                        if (n.Type is Type t)
                        {
                            var atts = DisplayAttributeHelper.FindDisplayAttributes(t);
                            if (!atts.IsValid())
                            {
                                continue;
                            }
                            dt = new DataTable();
                            dt.Columns.Add("I050008");
                            foreach (var a in atts)
                            {
                                dt.Columns.Add(a.Text);
                            }

                            foreach (var i in n.Items.View)
                            {
                                DataRow dr = dt.NewRow();
                                foreach (var a in atts)
                                {
                                    dr[a.Text] = a.GetValue(i);
                                }
                                dt.Rows.Add(dr);
                            }
                        }
                        else
                        {
                            //dt = new DataTable();
                            //dt.Columns.Add("I050008");
                            //Domains.DataView dv = pluginInfo.DataView[0];
                            //for (int i = 0; i < pluginInfo.DataView.Count; i++)
                            //{
                            //    if (pluginInfo.DataView[i].Type == n.Type.ToString())
                            //    {
                            //        dv = pluginInfo.DataView[i];
                            //    }
                            //}
                            //foreach (var model in n.Items.View)
                            //{
                            //    var info = model as DynamicEx;
                            //    foreach (var pair in info.Members)
                            //    {
                            //        string key = GetColumnNameFromDynamicX(dv, pair.Key);
                            //        if (!dt.Columns.Contains(key))
                            //            dt.Columns.Add(key);
                            //    }
                            //    DataRow dr = dt.NewRow();
                            //    foreach (var pair in info.Members)
                            //    {
                            //        string key = GetColumnNameFromDynamicX(dv, pair.Key);
                            //        dr[key] = pair.Value == null ? string.Empty : pair.Value.ToString();
                            //    }
                            //    dt.Rows.Add(dr);
                            //}
                        }
                    }

                    BcpNode bcpNode = new BcpNode()
                    {
                        DataTable = dt, TreeNode = n, XmlNode = xmlnode
                    };
                    lstBcpNodes.Add(bcpNode);

                    if (n.TreeNodes.IsValid())
                    {
                        CreateXmlTreeNodeFromTreeSource(xmldoc, n.TreeNodes, pluginInfo, xmlnode, lstBcpNodes);
                    }
                }
            }
        }