private List<Error> validateAttribute(MetadataAttributeModel aModel) { List<Error> errors = new List<Error>(); //optional check if (aModel.MinCardinality > 0 && (aModel.Value == null || String.IsNullOrEmpty(aModel.Value.ToString()))) errors.Add(new Error(ErrorType.MetadataAttribute, "is not optional", new object[] { aModel.DisplayName, aModel.Value, aModel.Number, aModel.ParentModelNumber, aModel.Parent.Label })); else if (aModel.MinCardinality > 0 && String.IsNullOrEmpty(aModel.Value.ToString())) errors.Add(new Error(ErrorType.MetadataAttribute, "is not optional", new object[] { aModel.DisplayName, aModel.Value, aModel.Number, aModel.ParentModelNumber, aModel.Parent.Label })); //check datatype if (aModel.Value != null && !String.IsNullOrEmpty(aModel.Value.ToString())) { if (!DataTypeUtility.IsTypeOf(aModel.Value, aModel.SystemType)) { errors.Add(new Error(ErrorType.MetadataAttribute, "Value can´t convert to the type: " + aModel.SystemType + ".", new object[] { aModel.DisplayName, aModel.Value, aModel.Number, aModel.ParentModelNumber, aModel.Parent.Label })); } else { Type type = Type.GetType("System." + aModel.SystemType); object value = Convert.ChangeType(aModel.Value, type); // check Constraints foreach (Constraint constraint in aModel.GetMetadataAttribute().Constraints) { if (value != null && !constraint.IsSatisfied(value)) { errors.Add(new Error(ErrorType.MetadataAttribute, constraint.ErrorMessage, new object[] { aModel.DisplayName, aModel.Value, aModel.Number, aModel.ParentModelNumber, aModel.Parent.Label })); } } } } //// dataset title node should be check if its exit or not //if (errors.Count == 0 && aModel.DataType.ToLower().Contains("string")) //{ // XmlReader reader =; //} if (errors.Count == 0) return null; else return errors; }