internal override int Compile(ValidationEventHandler h, XmlSchema schema) { if (this.CompilationId == schema.CompilationId) { return(0); } if (this.Content == null) { base.error(h, "Content must be present in a simpleContent"); } else if (this.Content is XmlSchemaSimpleContentRestriction) { XmlSchemaSimpleContentRestriction xmlSchemaSimpleContentRestriction = (XmlSchemaSimpleContentRestriction)this.Content; this.errorCount += xmlSchemaSimpleContentRestriction.Compile(h, schema); } else if (this.Content is XmlSchemaSimpleContentExtension) { XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension = (XmlSchemaSimpleContentExtension)this.Content; this.errorCount += xmlSchemaSimpleContentExtension.Compile(h, schema); } else { base.error(h, "simpleContent can't have any value other than restriction or extention"); } XmlSchemaUtil.CompileID(base.Id, this, schema.IDCollection, h); this.CompilationId = schema.CompilationId; return(this.errorCount); }
///<remarks> /// 1. Content must be present and one of restriction or extention ///</remarks> internal override int Compile(ValidationEventHandler h, XmlSchema schema) { // If this is already compiled this time, simply skip. if (CompilationId == schema.CompilationId) { return(0); } if (Content == null) { error(h, "Content must be present in a simpleContent"); } else { if (Content is XmlSchemaSimpleContentRestriction) { XmlSchemaSimpleContentRestriction xscr = (XmlSchemaSimpleContentRestriction)Content; errorCount += xscr.Compile(h, schema); } else if (Content is XmlSchemaSimpleContentExtension) { XmlSchemaSimpleContentExtension xsce = (XmlSchemaSimpleContentExtension)Content; errorCount += xsce.Compile(h, schema); } else { error(h, "simpleContent can't have any value other than restriction or extention"); } } XmlSchemaUtil.CompileID(Id, this, schema.IDCollection, h); this.CompilationId = schema.CompilationId; return(errorCount); }