示例#1
0
        public void XmlInterate()
        {
            string aaaArg = string.Empty;

            string path  = Path.Combine(Environment.CurrentDirectory, "ioc.xml");
            bool   isObj = false;

            Xmtool.Xml().Iterate(path, (XmlNodeInfo node) =>
            {
                if (!node.IsEndNode)
                {
                    if (node.Path == "/objects/object")
                    {
                        isObj = node.GetAttribute("id") == "aaa";
                    }
                    else if (node.Path == "/objects/object/constructor-arg/@text")
                    {
                        if (isObj)
                        {
                            aaaArg = node.Text;
                        }
                    }

                    output.WriteLine(node.FullPath);
                }
                return(true);
            });

            Assert.Equal("\"wangxm\"", aaaArg);
        }
示例#2
0
        public void XmlSerialize()
        {
            string  xml = @"<xml>
                <test id='demo'>
                    <hello id='aaa' />
                    <world>123</world>
                </test>
                <name><![CDATA[张三]]></name>
                <age>18</age>
                <gender>男</gender>
            </xml>";
            dynamic obj = Xmtool.Xml().DeserializeFromString(xml);

            Assert.NotNull(obj);
            Assert.Equal("张三", obj.name.Value);
            Assert.Equal("aaa", obj.test.hello.id);
        }
示例#3
0
        public void XmlNodeLevel()
        {
            string xml = @"<xml>
                <name><![CDATA[张三]]></name>
                <age>18</age>
                <gender>男</gender>
            </xml>";

            int nameLevel = 0;

            Xmtool.Xml().IterateFromString(xml, (XmlNodeInfo node) =>
            {
                if (node.Path == "/xml/name")
                {
                    nameLevel = node.Level;
                }
                return(true);
            });
            Assert.Equal(2, nameLevel);
        }
示例#4
0
        public void XmlRootNode()
        {
            string xml = @"<xml>
                <name><![CDATA[张三]]></name>
                <age>18</age>
                <gender>男</gender>
            </xml>";

            bool xmlIsRoot = false;

            Xmtool.Xml().IterateFromString(xml, (XmlNodeInfo node) =>
            {
                if (node.Path == "/xml")
                {
                    xmlIsRoot = node.IsRoot;
                }
                return(true);
            });
            Assert.True(xmlIsRoot);
        }
示例#5
0
        public void XmlIterateFromString()
        {
            int age = 0;

            string xml = @"<xml>
                <name>уехЩ</name>
                <age>18</age>
                <gender>дп</gender>
            </xml>";

            Xmtool.Xml().IterateFromString(xml, (XmlNodeInfo node) =>
            {
                if (!node.IsEndNode)
                {
                    if (node.Path == "/xml/age/@text")
                    {
                        age = int.Parse(node.Text);
                    }
                }
                return(true);
            });

            Assert.Equal(18, age);
        }
示例#6
0
        internal static Model ParseModel(string modelFilePath, string parent)
        {
            Model model = new Model();

            model.Path = parent.ToLower();

            Xmtool.Xml().Iterate(modelFilePath, (nodeInfo) =>
            {
                if (nodeInfo.Path == "/model")
                {
                    if (!nodeInfo.IsEndNode)
                    {
                        string name = nodeInfo.GetAttribute("name");
                        if (name == null)
                        {
                            throw new Exception("缺少name属性。 " + modelFilePath + " - Line " + nodeInfo.Line);
                        }
                        else if (string.IsNullOrWhiteSpace(name))
                        {
                            throw new Exception("name属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                        }
                        model.Name = name.Trim();

                        string table = nodeInfo.GetAttribute("table");
                        if (table != null)
                        {
                            if (string.IsNullOrWhiteSpace(table))
                            {
                                throw new Exception("table属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                            model.Table = table.Trim();
                        }
                        else
                        {
                            model.Table = model.Name;
                        }

                        string beforeSaveProcStr = nodeInfo.GetAttribute("beforeSave");
                        if (beforeSaveProcStr != null)
                        {
                            beforeSaveProcStr = beforeSaveProcStr.Trim();
                            if (beforeSaveProcStr.Length > 4 &&
                                beforeSaveProcStr.StartsWith("{{") &&
                                beforeSaveProcStr.EndsWith("}}"))
                            {
                                model.BeforeSaveProcessor = beforeSaveProcStr.Substring(2, beforeSaveProcStr.Length - 4);
                            }
                            else
                            {
                                throw new Exception("beforeSave属性必须是Processor。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string afterSaveProcStr = nodeInfo.GetAttribute("afterSave");
                        if (afterSaveProcStr != null)
                        {
                            afterSaveProcStr = afterSaveProcStr.Trim();
                            if (afterSaveProcStr.Length > 4 &&
                                afterSaveProcStr.StartsWith("{{") &&
                                afterSaveProcStr.EndsWith("}}"))
                            {
                                model.AfterSaveProcessor = afterSaveProcStr.Substring(2, afterSaveProcStr.Length - 4);
                            }
                            else
                            {
                                throw new Exception("afterSave属性必须是Processor。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string beforeDeleteProcStr = nodeInfo.GetAttribute("beforeDelete");
                        if (beforeDeleteProcStr != null)
                        {
                            beforeDeleteProcStr = beforeDeleteProcStr.Trim();
                            if (beforeDeleteProcStr.Length > 4 &&
                                beforeDeleteProcStr.StartsWith("{{") &&
                                beforeDeleteProcStr.EndsWith("}}"))
                            {
                                model.BeforeDeleteProcessor = beforeDeleteProcStr.Substring(2, beforeDeleteProcStr.Length - 4);
                            }
                            else
                            {
                                throw new Exception("beforeDelete属性必须是Processor。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string afterDeleteProcStr = nodeInfo.GetAttribute("afterDelete");
                        if (afterDeleteProcStr != null)
                        {
                            afterDeleteProcStr = afterDeleteProcStr.Trim();
                            if (afterDeleteProcStr.Length > 4 &&
                                afterDeleteProcStr.StartsWith("{{") &&
                                afterDeleteProcStr.EndsWith("}}"))
                            {
                                model.AfterDeleteProcessor = afterDeleteProcStr.Substring(2, afterDeleteProcStr.Length - 4);
                            }
                            else
                            {
                                throw new Exception("afterDelete属性必须是Processor。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }
                    }
                }
                else if (nodeInfo.Path == "/model/property")
                {
                    if (!nodeInfo.IsEndNode)
                    {
                        Property p = new Property();
                        DelayCheckPropertySetting dcps = null;

                        string name = nodeInfo.GetAttribute("name");
                        if (name == null)
                        {
                            throw new Exception("缺少name属性。 " + modelFilePath + " - Line " + nodeInfo.Line);
                        }
                        else if (string.IsNullOrWhiteSpace(name))
                        {
                            throw new Exception("name属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                        }
                        p.Name = name.Trim();

                        string field = nodeInfo.GetAttribute("field");
                        if (field != null)
                        {
                            if (string.IsNullOrWhiteSpace(field))
                            {
                                throw new Exception("field属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                            p.Field = field.Trim();
                        }
                        else
                        {
                            p.Field = string.Concat("f_", p.Name.ToLower());
                        }

                        Type type      = typeof(string);
                        string typeStr = nodeInfo.GetAttribute("type");
                        if (typeStr != null)
                        {
                            type = GetPropertyType(typeStr);
                            if (type == null)
                            {
                                throw new Exception("type属性非法。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                            else if (type == typeof(Model) ||
                                     type == typeof(DynamicObjectExt))
                            {
                                p.TypeValue = typeStr;

                                dcps          = new DelayCheckPropertySetting();
                                dcps.Position = modelFilePath + " - Line " + nodeInfo.Line;
                            }
                        }
                        else
                        {
                            string aiStr = nodeInfo.GetAttribute("autoIncrement");
                            if (aiStr != null)
                            {
                                if (!string.IsNullOrWhiteSpace(aiStr) &&
                                    reBool.IsMatch(aiStr))
                                {
                                    type = typeof(Int32);
                                }
                            }
                        }
                        p.Type     = type;
                        p.RealType = type;

                        string joinPropStr = nodeInfo.GetAttribute("joinProp");
                        if (joinPropStr != null)
                        {
                            if (p.Type == typeof(Model))
                            {
                                if (string.IsNullOrWhiteSpace(joinPropStr))
                                {
                                    throw new Exception("joinProp属性不能为空。" + modelFilePath + " - Line " + nodeInfo.Line);
                                }
                                p.JoinProp = joinPropStr.Trim();
                            }
                            else
                            {
                                throw new Exception("joinProp属性只在type属性为Model类型时有效。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string fieldTypeStr = nodeInfo.GetAttribute("fieldType");
                        if (fieldTypeStr != null)
                        {
                            if (type == typeof(DynamicObjectExt))
                            {
                                throw new Exception(typeStr + "类型的Property禁止设置fieldType。" + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            try
                            {
                                p.FieldType = Enum.Parse <DbType>(fieldTypeStr, true);
                                p.RealType  = DbType2Type(p.FieldType);
                            }
                            catch
                            {
                                throw new Exception("fieldType属性非法。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }
                        else
                        {
                            p.FieldType = Type2DbType(type);
                            if (p.Type == typeof(Model))
                            {
                                dcps.FieldTypeNotSet = true;
                            }
                        }

                        string lengthStr = nodeInfo.GetAttribute("length");
                        if (lengthStr != null)
                        {
                            if (string.IsNullOrWhiteSpace(lengthStr))
                            {
                                throw new Exception("length属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            if (!Xmtool.Regex().IsPositiveInteger(lengthStr))
                            {
                                throw new Exception("length属性必须是有效正整数。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            p.Length = int.Parse(lengthStr);
                        }
                        else
                        {
                            p.Length = FieldUtils.GetFieldLength(model, p.FieldType);
                            if (p.Type == typeof(DynamicObjectExt))
                            {
                                p.Length = 512;
                            }
                            else if (p.Type == typeof(Model))
                            {
                                dcps.LengthNotSet = true;
                            }
                        }

                        string minStr = nodeInfo.GetAttribute("min");
                        if (minStr != null)
                        {
                            if (FieldUtils.IsNumeric(p.FieldType))
                            {
                                if (string.IsNullOrWhiteSpace(minStr))
                                {
                                    throw new Exception("min属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                                }

                                if (!Xmtool.Regex().IsNumber(minStr))
                                {
                                    throw new Exception("min属性必须是有效数值。 " + modelFilePath + " - Line " + nodeInfo.Line);
                                }

                                p.MinValue = double.Parse(minStr);
                            }
                            else
                            {
                                throw new NotSupportedException(p.FieldType.ToString() + "类型不支持min设置。" + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string maxStr = nodeInfo.GetAttribute("max");
                        if (maxStr != null)
                        {
                            if (FieldUtils.IsNumeric(p.FieldType))
                            {
                                if (string.IsNullOrWhiteSpace(maxStr))
                                {
                                    throw new Exception("max属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                                }

                                if (!Xmtool.Regex().IsNumber(maxStr))
                                {
                                    throw new Exception("max属性必须是有效数值。 " + modelFilePath + " - Line " + nodeInfo.Line);
                                }

                                p.MaxValue = double.Parse(maxStr);
                            }
                            else
                            {
                                throw new NotSupportedException(p.FieldType.ToString() + "类型不支持max设置。" + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string precisionStr = nodeInfo.GetAttribute("precision");
                        if (precisionStr != null)
                        {
                            if (FieldUtils.IsFloat(p.FieldType))
                            {
                                if (string.IsNullOrWhiteSpace(precisionStr))
                                {
                                    throw new Exception("precision属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                                }

                                if (!Xmtool.Regex().IsNaturalInteger(precisionStr))
                                {
                                    throw new Exception("precision属性必须是有效自然数。 " + modelFilePath + " - Line " + nodeInfo.Line);
                                }

                                p.Precision = int.Parse(precisionStr);
                            }
                            else
                            {
                                throw new NotSupportedException(p.FieldType.ToString() + "类型不支持precision设置。" + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string notNullStr = nodeInfo.GetAttribute("notNull");
                        if (notNullStr != null)
                        {
                            if (string.IsNullOrWhiteSpace(notNullStr))
                            {
                                throw new Exception("notNull属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            if (!reBool.IsMatch(notNullStr))
                            {
                                throw new Exception("notNull属性必须是布尔型。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            p.IsNotNull = bool.Parse(notNullStr);
                        }

                        string descStr = nodeInfo.GetAttribute("desc");
                        if (!string.IsNullOrEmpty(descStr))
                        {
                            p.Description = descStr;
                        }

                        string autoIncrStr = nodeInfo.GetAttribute("autoIncrement");
                        if (autoIncrStr != null)
                        {
                            if (FieldUtils.IsInteger(p.FieldType))
                            {
                                if (string.IsNullOrWhiteSpace(autoIncrStr))
                                {
                                    throw new Exception("autoIncrement属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                                }

                                if (!reBool.IsMatch(autoIncrStr))
                                {
                                    throw new Exception("autoIncrement属性必须是布尔型。 " + modelFilePath + " - Line " + nodeInfo.Line);
                                }

                                p.AutoIncrement = bool.Parse(autoIncrStr);
                            }
                            else
                            {
                                throw new NotSupportedException(p.FieldType.ToString() + "类型不支持autoIncrement设置。" + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string unsignedStr = nodeInfo.GetAttribute("unsigned");
                        if (unsignedStr != null)
                        {
                            if (FieldUtils.IsNumeric(p.FieldType))
                            {
                                if (string.IsNullOrWhiteSpace(unsignedStr))
                                {
                                    throw new Exception("unsigned属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                                }

                                if (!reBool.IsMatch(unsignedStr))
                                {
                                    throw new Exception("unsigned属性必须是布尔型。 " + modelFilePath + " - Line " + nodeInfo.Line);
                                }

                                p.Unsigned = bool.Parse(unsignedStr);
                            }
                            else
                            {
                                throw new NotSupportedException(p.FieldType.ToString() + "类型不支持unsigned设置。" + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string uniqueGroupStr = nodeInfo.GetAttribute("uniqueGroup");
                        if (uniqueGroupStr != null)
                        {
                            if (string.IsNullOrWhiteSpace(uniqueGroupStr))
                            {
                                throw new Exception("uniqueGroup属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                            p.UniqueGroup = uniqueGroupStr.Trim();
                        }

                        string indexGroupStr = nodeInfo.GetAttribute("indexGroup");
                        if (indexGroupStr != null)
                        {
                            if (string.IsNullOrWhiteSpace(indexGroupStr))
                            {
                                throw new Exception("indexGroup属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                            p.IndexGroup = indexGroupStr.Trim();
                        }

                        string primaryStr = nodeInfo.GetAttribute("primary");
                        if (primaryStr != null)
                        {
                            if (string.IsNullOrWhiteSpace(primaryStr))
                            {
                                throw new Exception("primary属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            if (!reBool.IsMatch(primaryStr))
                            {
                                throw new Exception("primary属性必须是布尔型。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            p.IsPrimaryKey = bool.Parse(primaryStr);
                        }

                        string defaultStr = nodeInfo.GetAttribute("defaultValue");
                        if (defaultStr != null)
                        {
                            p.DefaultValue = defaultStr.Trim();
                        }

                        string beforeProcStr = nodeInfo.GetAttribute("beforeSave");
                        if (beforeProcStr != null)
                        {
                            beforeProcStr = beforeProcStr.Trim();
                            if (beforeProcStr.Length > 4 &&
                                beforeProcStr.StartsWith("{{") &&
                                beforeProcStr.EndsWith("}}"))
                            {
                                p.BeforeSaveProcessor = beforeProcStr.Substring(2, beforeProcStr.Length - 4);
                            }
                            else
                            {
                                throw new Exception("beforeSave属性必须是Processor。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string afterProcStr = nodeInfo.GetAttribute("afterQuery");
                        if (afterProcStr != null)
                        {
                            afterProcStr = afterProcStr.Trim();
                            if (afterProcStr.Length > 4 &&
                                afterProcStr.StartsWith("{{") &&
                                afterProcStr.EndsWith("}}"))
                            {
                                p.AfterQueryProcessor = afterProcStr.Substring(2, afterProcStr.Length - 4);
                            }
                            else
                            {
                                throw new Exception("afterQuery属性必须是Processor。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }
                        }

                        string joinInsertStr = nodeInfo.GetAttribute("joinInsert");
                        if (joinInsertStr != null)
                        {
                            if (string.IsNullOrWhiteSpace(joinInsertStr))
                            {
                                throw new Exception("joinInsert属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            if (!reBool.IsMatch(joinInsertStr))
                            {
                                throw new Exception("joinInsert属性必须是布尔型。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            p.JoinInsert = bool.Parse(joinInsertStr);
                        }

                        string joinUpdateStr = nodeInfo.GetAttribute("joinUpdate");
                        if (joinUpdateStr != null)
                        {
                            if (string.IsNullOrWhiteSpace(joinUpdateStr))
                            {
                                throw new Exception("joinUpdate属性不能为空。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            if (!reBool.IsMatch(joinUpdateStr))
                            {
                                throw new Exception("joinUpdate属性必须是布尔型。 " + modelFilePath + " - Line " + nodeInfo.Line);
                            }

                            p.JoinUpdate = bool.Parse(joinUpdateStr);
                        }

                        model.AddProperty(p);

                        if (dcps != null)
                        {
                            sDelayCheckProperties.TryAdd(p, dcps);
                        }
                    }
                }

                return(true);
            });
            return(model);
        }
示例#7
0
        private static ConnectionSetting ParseConnectionSetting(string connectionFilePath)
        {
            ConnectionSetting result = new ConnectionSetting();

            Xmtool.Xml().Iterate(connectionFilePath, (nodeInfo) => {
                if (!nodeInfo.IsEndNode)
                {
                    if (nodeInfo.Path == "/connection/dialect/@text")
                    {
                        result.Dialect = nodeInfo.Text.Trim().ToLower();
                    }
                    else if (nodeInfo.Path == "/connection/host/@text")
                    {
                        result.Host = nodeInfo.Text.Trim();
                    }
                    else if (nodeInfo.Path == "/connection/port/@text")
                    {
                        int port;
                        if (int.TryParse(nodeInfo.Text, out port))
                        {
                            result.Port = port;
                        }
                        else
                        {
                            throw new Exception("name属性不能为空。 " + connectionFilePath + " - Line " + nodeInfo.Line);
                        }
                    }
                    else if (nodeInfo.Path == "/connection/user/@text")
                    {
                        result.User = nodeInfo.Text.Trim();
                    }
                    else if (nodeInfo.Path == "/connection/password/@text")
                    {
                        result.Password = nodeInfo.Text.Trim();
                    }
                    else if (nodeInfo.Path == "/connection/database/@text")
                    {
                        result.Database = nodeInfo.Text.Trim();
                    }
                    else if (nodeInfo.Path == "/connection/charset/@text")
                    {
                        result.Charset = nodeInfo.Text.Trim();
                    }
                    else if (nodeInfo.Path == "/connection/encrypt/@text")
                    {
                        if (!reBool.IsMatch(nodeInfo.Text.Trim()))
                        {
                            throw new Exception("encrypt节点值必须是布尔型。 " + connectionFilePath + " - Line " + nodeInfo.Line);
                        }
                        result.Encrypt = bool.Parse(nodeInfo.Text.Trim());
                    }
                    else if (nodeInfo.Path == "/connection/pool")
                    {
                        string maxStr = nodeInfo.GetAttribute("max");
                        if (!Xmtool.Regex().IsPositiveInteger(maxStr))
                        {
                            throw new Exception("max属性必须是有效正整数。 " + connectionFilePath + " - Line " + nodeInfo.Line);
                        }
                        result.MaxPoolSize = int.Parse(maxStr);

                        string minStr = nodeInfo.GetAttribute("min");
                        if (!Xmtool.Regex().IsNaturalInteger(minStr))
                        {
                            throw new Exception("min属性必须是有效自然数。 " + connectionFilePath + " - Line " + nodeInfo.Line);
                        }
                        result.MinPoolSize = int.Parse(minStr);
                    }
                    else if (nodeInfo.Path == "/connection/pool/@text")
                    {
                        if (!reBool.IsMatch(nodeInfo.Text.Trim()))
                        {
                            throw new Exception("pool节点值必须是布尔型。 " + connectionFilePath + " - Line " + nodeInfo.Line);
                        }
                        result.Pooling = bool.Parse(nodeInfo.Text.Trim());
                    }
                }
                return(true);
            });
            return(result);
        }
示例#8
0
        public static void LoadFile(string path, bool append = true)
        {
            if (!append)
            {
                sConfigs.Clear();
            }

            if (File.Exists(path))
            {
                ObjectConfig         currentConfig       = null;
                string               currentParamRefId   = string.Empty;
                Type                 currentParamType    = null;
                IList                currentParamList    = null;
                RefListObjectSetting currentParamRefList = null;
                string               currentPropertyName = string.Empty;

                Regex reInt    = new Regex("^[0-9]*$", RegexOptions.None);
                Regex reDouble = new Regex("^[0-9\\.]*$", RegexOptions.None);

                Xmtool.Xml().Iterate(path, (XmlNodeInfo nodeInfo) =>
                {
                    if (nodeInfo.Path == "/objects/object")
                    {
                        if (!nodeInfo.IsEndNode)
                        {
                            string attrId = nodeInfo.GetAttribute("id");
                            if (attrId == null)
                            {
                                throw new Exception("id属性是必须的" + ": " + path + " line " + nodeInfo.Line);
                            }
                            else if (string.IsNullOrWhiteSpace(attrId))
                            {
                                throw new Exception("id属性不能为空" + ": " + path + " line " + nodeInfo.Line);
                            }

                            string attrClass = nodeInfo.GetAttribute("class");
                            if (attrClass == null)
                            {
                                throw new Exception("class属性是必须的" + ": " + path + " line " + nodeInfo.Line);
                            }
                            else if (string.IsNullOrWhiteSpace(attrClass))
                            {
                                throw new Exception("class属性不能为空" + ": " + path + " line " + nodeInfo.Line);
                            }

                            currentConfig       = new ObjectConfig();
                            currentConfig.Id    = attrId;
                            currentConfig.Class = attrClass;
                            sConfigs.AddOrUpdate(attrId.ToLower(), currentConfig, (oldKey, oldValue) => { return(currentConfig); });
                        }
                        else
                        {
                            currentConfig = null;
                        }
                    }
                    else if (nodeInfo.Path == "/objects/object/constructor-arg" ||
                             nodeInfo.Path == "/objects/object/property")
                    {
                        if (!nodeInfo.IsEndNode)
                        {
                            if (nodeInfo.Path == "/objects/object/property")
                            {
                                currentPropertyName = nodeInfo.GetAttribute("name");
                                if (string.IsNullOrWhiteSpace(currentPropertyName))
                                {
                                    throw new Exception("name属性不能为空" + ": " + path + " line " + nodeInfo.Line);
                                }
                            }

                            currentParamRefId = nodeInfo.GetAttribute("ref");
                            if (string.IsNullOrWhiteSpace(currentParamRefId))
                            {
                                string typeName = nodeInfo.GetAttribute("type");
                                if (typeName != null)
                                {
                                    if (!string.IsNullOrWhiteSpace(typeName))
                                    {
                                        if (!typeName.Contains("."))
                                        {
                                            //System下的简单数据类型
                                            currentParamType = Type.GetType("System." + typeName, true, true);
                                        }
                                        else
                                        {
                                            //用户自定义类型
                                            currentParamType = AssemblyUtils.GetType(typeName);
                                        }
                                    }
                                    else
                                    {
                                        throw new Exception("type属性不能为空" + ": " + path + " line " + nodeInfo.Line);
                                    }
                                }
                                else
                                {
                                    currentParamType = null;
                                }
                            }
                        }
                        else
                        {
                            currentParamRefId   = string.Empty;
                            currentParamType    = null;
                            currentPropertyName = string.Empty;
                        }
                    }
                    else if (nodeInfo.Path == "/objects/object/constructor-arg/@text")
                    {
                        if (string.IsNullOrWhiteSpace(currentParamRefId))
                        {
                            string paramValue = nodeInfo.Text.Trim();
                            handleListValue(currentConfig.ConstructorParams, paramValue, currentParamType, path, nodeInfo.Line);
                        }
                        else
                        {
                            int index = currentConfig.ConstructorParams.Count +
                                        currentConfig.RefConstructorParams.Count;
                            currentConfig.RefConstructorParams.Add(new RefObjectSetting(currentParamRefId, index));
                        }

                        //TODO 对象构造支持更多的参数类型      Hashtable、Dictionary、HashSet等
                    }
                    else if (nodeInfo.Path == "/objects/object/property/@text")
                    {
                        if (string.IsNullOrWhiteSpace(currentParamRefId))
                        {
                            string propertyValue        = nodeInfo.Text.Trim();
                            PropertySetting propSetting = new PropertySetting(currentPropertyName, propertyValue);
                            currentConfig.Properties.Add(propSetting);
                        }
                        else
                        {
                            PropertySetting propSetting = new PropertySetting(currentPropertyName);
                            propSetting.RefId           = currentParamRefId;
                            currentConfig.Properties.Add(propSetting);
                        }
                    }
                    else if (nodeInfo.Path == "/objects/object/constructor-arg/list" ||
                             nodeInfo.Path == "/objects/object/constructor-arg/array")
                    {
                        if (!nodeInfo.IsEndNode)
                        {
                            bool isUserType = false;

                            string typeName = nodeInfo.GetAttribute("type");
                            if (typeName != null)
                            {
                                if (!string.IsNullOrWhiteSpace(typeName))
                                {
                                    if (!typeName.Contains("."))
                                    {
                                        //System下的简单数据类型
                                        currentParamType = Type.GetType("System." + typeName, true, true);
                                    }
                                    else
                                    {
                                        //用户自定义类型
                                        currentParamType = AssemblyUtils.GetType(typeName);
                                        isUserType       = !currentParamType.IsEnum;
                                    }
                                }
                                else
                                {
                                    throw new Exception("type属性不能为空" + ": " + path + " line " + nodeInfo.Line);
                                }

                                Type geneType      = typeof(List <>);
                                Type implType      = geneType.MakeGenericType(currentParamType);
                                ConstructorInfo ci = implType.GetConstructor(new Type[] { });
                                currentParamList   = ci.Invoke(new Object[] { }) as IList;
                            }
                            else
                            {
                                currentParamType = Type.GetType("System.Object", true, true);
                                currentParamList = new List <object>();
                            }

                            if (isUserType)
                            {
                                int index = currentConfig.ConstructorParams.Count +
                                            currentConfig.RefConstructorParams.Count;
                                bool isArray        = nodeInfo.Path == "/objects/object/constructor-arg/array";
                                currentParamRefList = new RefListObjectSetting(index, currentParamList, isArray);
                            }
                        }
                        else
                        {
                            if (currentParamRefList == null)
                            {
                                if (nodeInfo.Path == "/objects/object/constructor-arg/list")
                                {
                                    currentConfig.ConstructorParams.Add(currentParamList);
                                }
                                else if (nodeInfo.Path == "/objects/object/constructor-arg/array")
                                {
                                    Array argArray = Array.CreateInstance(currentParamType, currentParamList.Count);
                                    currentParamList.CopyTo(argArray, 0);
                                    currentConfig.ConstructorParams.Add(argArray);
                                }
                            }
                            else
                            {
                                currentConfig.RefConstructorParams.Add(currentParamRefList);
                            }

                            currentParamType    = null;
                            currentParamList    = null;
                            currentParamRefList = null;
                        }
                    }
                    else if (nodeInfo.Path == "/objects/object/constructor-arg/list/value" ||
                             nodeInfo.Path == "/objects/object/constructor-arg/array/value")
                    {
                        if (!nodeInfo.IsEndNode)
                        {
                            if (currentParamRefList != null)
                            {
                                currentParamRefId = nodeInfo.GetAttribute("ref");
                                if (!string.IsNullOrWhiteSpace(currentParamRefId))
                                {
                                    currentParamRefList.ItemList.Add(currentParamRefId);
                                }
                                else
                                {
                                    throw new Exception("ref属性不能为空" + ": " + path + " line " + nodeInfo.Line);
                                }
                            }
                        }
                        else
                        {
                            currentParamRefId = string.Empty;
                        }
                    }
                    else if (nodeInfo.Path == "/objects/object/constructor-arg/list/value/@text" ||
                             nodeInfo.Path == "/objects/object/constructor-arg/array/value/@text")
                    {
                        if (currentParamRefList == null)
                        {
                            string paramValue = nodeInfo.Text.Trim();
                            handleListValue(currentParamList, paramValue, currentParamType, path, nodeInfo.Line);
                        }
                    }

                    return(true);
                });
            }
        }