protected internal override void Read(XmlSchemaObject obj) { var type = (XmlSchemaComplexType)obj; if (type.Particle == null) { throw new InvalidOperationException(string.Format("Missing particle on choice type '{0}'", type.Name)); } var choice = type.Particle as XmlSchemaChoice; if (choice == null) { throw new InvalidOperationException(string.Format("Unexpected particle type '{0}' on choice type '{1}'", type.Particle.GetType(), type.Name)); } MaxOccurs = !string.IsNullOrEmpty(choice.MaxOccursString) ? choice.MaxOccurs : (decimal?)null; foreach (var item in choice.Items) { var element = item as XmlSchemaElement; if (element == null) { throw new InvalidOperationException(string.Format("Unexpected item type '{0}' on choice type '{1}'", item.GetType(), type.Name)); } var choiceType = new SDataSchemaChoiceItem(); choiceType.Read(element); Types.Add(choiceType); } base.Read(obj); }
protected internal override void Read(XmlSchemaObject obj) { var type = (XmlSchemaComplexType) obj; if (type.Particle == null) { throw new InvalidOperationException(string.Format("Missing particle on choice type '{0}'", type.Name)); } var choice = type.Particle as XmlSchemaChoice; if (choice == null) { throw new InvalidOperationException(string.Format("Unexpected particle type '{0}' on choice type '{1}'", type.Particle.GetType(), type.Name)); } MaxOccurs = !string.IsNullOrEmpty(choice.MaxOccursString) ? choice.MaxOccurs : (decimal?) null; foreach (var item in choice.Items) { var element = item as XmlSchemaElement; if (element == null) { throw new InvalidOperationException(string.Format("Unexpected item type '{0}' on choice type '{1}'", item.GetType(), type.Name)); } var choiceType = new SDataSchemaChoiceItem(); choiceType.Read(element); Types.Add(choiceType); } base.Read(obj); }