Finds all data validations in an InfoPath form
Наследование: InfoPathFeature
        public static IEnumerable<InfoPathFeature> ParseFeature(XDocument document)
        {
            // we don't care about the condition details, just "any custom validation" vs "native cbb"
            IEnumerable<XElement> allValidations = document.Descendants(xsfNamespace + customValidation);
            foreach (XElement validationElement in allValidations)
            {
                DataValidation validation = new DataValidation();
                validation.ValidationType = "Custom validation";
                yield return validation;
            }

            allValidations = document.Descendants(xsf3Namespace + customValidation);
            foreach (XElement validationElement in allValidations)
            {
                DataValidation validation = new DataValidation();
                validation.ValidationType = "Cannot be blank";
                yield return validation;
            }

            yield break;
        }
Пример #2
0
        public static IEnumerable <InfoPathFeature> ParseFeature(XDocument document)
        {
            // we don't care about the condition details, just "any custom validation" vs "native cbb"
            IEnumerable <XElement> allValidations = document.Descendants(xsfNamespace + customValidation);

            foreach (XElement validationElement in allValidations)
            {
                DataValidation validation = new DataValidation();
                validation.ValidationType = "Custom validation";
                yield return(validation);
            }

            allValidations = document.Descendants(xsf3Namespace + customValidation);
            foreach (XElement validationElement in allValidations)
            {
                DataValidation validation = new DataValidation();
                validation.ValidationType = "Cannot be blank";
                yield return(validation);
            }

            yield break;
        }