/// <remarks> /// 1. MaxOccurs must be one. (default is also one) /// 2. MinOccurs must be zero or one. /// </remarks> internal override int Compile(ValidationEventHandler h, XmlSchema schema) { // If this is already compiled this time, simply skip. if (CompilationId == schema.CompilationId) { return(0); } this.schema = schema; if (MaxOccurs != Decimal.One) { error(h, "maxOccurs must be 1"); } if (MinOccurs != Decimal.One && MinOccurs != Decimal.Zero) { error(h, "minOccurs must be 0 or 1"); } XmlSchemaUtil.CompileID(Id, this, schema.IDCollection, h); CompileOccurence(h, schema); foreach (XmlSchemaObject obj in Items) { XmlSchemaElement elem = obj as XmlSchemaElement; if (elem != null) { if (elem.ValidatedMaxOccurs != Decimal.One && elem.ValidatedMaxOccurs != Decimal.Zero) { elem.error(h, "The {max occurs} of all the elements of 'all' must be 0 or 1. "); } errorCount += elem.Compile(h, schema); } else { error(h, "XmlSchemaAll can only contain Items of type Element"); } } this.CompilationId = schema.CompilationId; return(errorCount); }