Exemple #1
0
        private void ExtractData(XElement typeElement, SimpleType type)
        {
            var restriction = typeElement.Elements().SingleOrDefault(e => e.Name.LocalName.Contains("restriction"));

            if (restriction == null)
            {
                throw new Exception($"Element 'restriction' not found in type {typeElement.Name.NamespaceName}");
            }

            var baseTypeAttribute = restriction.Attribute("base");

            if (baseTypeAttribute == null)
            {
                throw new Exception($"Element 'restriction' must have attribute 'base'");
            }

            type.BaseType = baseTypeAttribute.Value;

            foreach (var restrictionElement in restriction.Elements())
            {
                var processedRestriction = Restriction.GetRestriction(restrictionElement);
                type.AddRestriction(processedRestriction);
            }
        }