/// <remarks> /// An Attribute group can only be defined as a child of XmlSchema or in XmlSchemaRedefine. /// The other attributeGroup has type XmlSchemaAttributeGroupRef. /// 1. Name must be present /// </remarks> internal override int Compile(ValidationEventHandler h, XmlSchema schema) { // If this is already compiled this time, simply skip. if (CompilationId == schema.CompilationId) { return(errorCount); } errorCount = 0; if (redefinedObject != null) { errorCount += redefined.Compile(h, schema); if (errorCount == 0) { redefined = (XmlSchemaAttributeGroup)redefinedObject; } } XmlSchemaUtil.CompileID(Id, this, schema.IDCollection, h); if (this.Name == null || this.Name == String.Empty) //1 { error(h, "Name is required in top level simpletype"); } else if (!XmlSchemaUtil.CheckNCName(this.Name)) // b.1.2 { error(h, "name attribute of a simpleType must be NCName"); } else { this.qualifiedName = new XmlQualifiedName(this.Name, AncestorSchema.TargetNamespace); } if (this.AnyAttribute != null) { errorCount += this.AnyAttribute.Compile(h, schema); } foreach (XmlSchemaObject obj in Attributes) { if (obj is XmlSchemaAttribute) { XmlSchemaAttribute attr = (XmlSchemaAttribute)obj; errorCount += attr.Compile(h, schema); } else if (obj is XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef gref = (XmlSchemaAttributeGroupRef)obj; errorCount += gref.Compile(h, schema); } else { error(h, "invalid type of object in Attributes property"); } } this.CompilationId = schema.CompilationId; return(errorCount); }
internal override int Compile(ValidationEventHandler h, XmlSchema schema) { if (this.CompilationId == schema.CompilationId) { return(0); } if (this.isRedefinedComponent) { if (base.Annotation != null) { base.Annotation.isRedefinedComponent = true; } if (this.AnyAttribute != null) { this.AnyAttribute.isRedefinedComponent = true; } foreach (XmlSchemaObject xmlSchemaObject in this.Attributes) { xmlSchemaObject.isRedefinedComponent = true; } } if (this.BaseTypeName == null || this.BaseTypeName.IsEmpty) { base.error(h, "base must be present, as a QName"); } else if (!XmlSchemaUtil.CheckQName(this.BaseTypeName)) { base.error(h, "BaseTypeName must be a QName"); } if (this.BaseType != null) { this.errorCount += this.BaseType.Compile(h, schema); } if (this.AnyAttribute != null) { this.errorCount += this.AnyAttribute.Compile(h, schema); } foreach (XmlSchemaObject xmlSchemaObject2 in this.Attributes) { if (xmlSchemaObject2 is XmlSchemaAttribute) { XmlSchemaAttribute xmlSchemaAttribute = (XmlSchemaAttribute)xmlSchemaObject2; this.errorCount += xmlSchemaAttribute.Compile(h, schema); } else if (xmlSchemaObject2 is XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef xmlSchemaAttributeGroupRef = (XmlSchemaAttributeGroupRef)xmlSchemaObject2; this.errorCount += xmlSchemaAttributeGroupRef.Compile(h, schema); } else { base.error(h, xmlSchemaObject2.GetType() + " is not valid in this place::SimpleContentRestriction"); } } XmlSchemaUtil.CompileID(base.Id, this, schema.IDCollection, h); this.CompilationId = schema.CompilationId; return(this.errorCount); }
internal override int Compile(ValidationEventHandler h, XmlSchema schema) { if (this.CompilationId == schema.CompilationId) { return(this.errorCount); } this.errorCount = 0; if (this.redefinedObject != null) { this.errorCount += this.redefined.Compile(h, schema); if (this.errorCount == 0) { this.redefined = (XmlSchemaAttributeGroup)this.redefinedObject; } } XmlSchemaUtil.CompileID(base.Id, this, schema.IDCollection, h); if (this.Name == null || this.Name == string.Empty) { base.error(h, "Name is required in top level simpletype"); } else if (!XmlSchemaUtil.CheckNCName(this.Name)) { base.error(h, "name attribute of a simpleType must be NCName"); } else { this.qualifiedName = new XmlQualifiedName(this.Name, base.AncestorSchema.TargetNamespace); } if (this.AnyAttribute != null) { this.errorCount += this.AnyAttribute.Compile(h, schema); } foreach (XmlSchemaObject xmlSchemaObject in this.Attributes) { if (xmlSchemaObject is XmlSchemaAttribute) { XmlSchemaAttribute xmlSchemaAttribute = (XmlSchemaAttribute)xmlSchemaObject; this.errorCount += xmlSchemaAttribute.Compile(h, schema); } else if (xmlSchemaObject is XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef xmlSchemaAttributeGroupRef = (XmlSchemaAttributeGroupRef)xmlSchemaObject; this.errorCount += xmlSchemaAttributeGroupRef.Compile(h, schema); } else { base.error(h, "invalid type of object in Attributes property"); } } this.CompilationId = schema.CompilationId; return(this.errorCount); }
/// <remarks> /// </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 (this.isRedefinedComponent) { if (Annotation != null) { Annotation.isRedefinedComponent = true; } if (AnyAttribute != null) { AnyAttribute.isRedefinedComponent = true; } foreach (XmlSchemaObject obj in Attributes) { obj.isRedefinedComponent = true; } if (Particle != null) { Particle.isRedefinedComponent = true; } } if (BaseTypeName == null || BaseTypeName.IsEmpty) { error(h, "base must be present, as a QName"); } else if (!XmlSchemaUtil.CheckQName(BaseTypeName)) { error(h, "BaseTypeName is not a valid XmlQualifiedName"); } if (this.AnyAttribute != null) { errorCount += AnyAttribute.Compile(h, schema); } foreach (XmlSchemaObject obj in Attributes) { if (obj is XmlSchemaAttribute) { XmlSchemaAttribute attr = (XmlSchemaAttribute)obj; errorCount += attr.Compile(h, schema); } else if (obj is XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef atgrp = (XmlSchemaAttributeGroupRef)obj; errorCount += atgrp.Compile(h, schema); } else { error(h, obj.GetType() + " is not valid in this place::ComplexConetnetExtension"); } } if (Particle != null) { if (Particle is XmlSchemaGroupRef) { errorCount += ((XmlSchemaGroupRef)Particle).Compile(h, schema); } else if (Particle is XmlSchemaAll) { errorCount += ((XmlSchemaAll)Particle).Compile(h, schema); } else if (Particle is XmlSchemaChoice) { errorCount += ((XmlSchemaChoice)Particle).Compile(h, schema); } else if (Particle is XmlSchemaSequence) { errorCount += ((XmlSchemaSequence)Particle).Compile(h, schema); } else { error(h, "Particle of a restriction is limited only to group, sequence, choice and all."); } } XmlSchemaUtil.CompileID(Id, this, schema.IDCollection, h); this.CompilationId = schema.CompilationId; return(errorCount); }
internal override int Compile(ValidationEventHandler h, XmlSchema schema) { if (this.CompilationId == schema.CompilationId) { return(0); } if (this.isRedefinedComponent) { if (base.Annotation != null) { base.Annotation.isRedefinedComponent = true; } if (this.AnyAttribute != null) { this.AnyAttribute.isRedefinedComponent = true; } foreach (XmlSchemaObject xmlSchemaObject in this.Attributes) { xmlSchemaObject.isRedefinedComponent = true; } if (this.Particle != null) { this.Particle.isRedefinedComponent = true; } } if (this.BaseTypeName == null || this.BaseTypeName.IsEmpty) { base.error(h, "base must be present, as a QName"); } else if (!XmlSchemaUtil.CheckQName(this.BaseTypeName)) { base.error(h, "BaseTypeName is not a valid XmlQualifiedName"); } if (this.AnyAttribute != null) { this.errorCount += this.AnyAttribute.Compile(h, schema); } foreach (XmlSchemaObject xmlSchemaObject2 in this.Attributes) { if (xmlSchemaObject2 is XmlSchemaAttribute) { XmlSchemaAttribute xmlSchemaAttribute = (XmlSchemaAttribute)xmlSchemaObject2; this.errorCount += xmlSchemaAttribute.Compile(h, schema); } else if (xmlSchemaObject2 is XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef xmlSchemaAttributeGroupRef = (XmlSchemaAttributeGroupRef)xmlSchemaObject2; this.errorCount += xmlSchemaAttributeGroupRef.Compile(h, schema); } else { base.error(h, xmlSchemaObject2.GetType() + " is not valid in this place::ComplexConetnetExtension"); } } if (this.Particle != null) { if (this.Particle is XmlSchemaGroupRef) { this.errorCount += ((XmlSchemaGroupRef)this.Particle).Compile(h, schema); } else if (this.Particle is XmlSchemaAll) { this.errorCount += ((XmlSchemaAll)this.Particle).Compile(h, schema); } else if (this.Particle is XmlSchemaChoice) { this.errorCount += ((XmlSchemaChoice)this.Particle).Compile(h, schema); } else if (this.Particle is XmlSchemaSequence) { this.errorCount += ((XmlSchemaSequence)this.Particle).Compile(h, schema); } else { base.error(h, "Particle of a restriction is limited only to group, sequence, choice and all."); } } XmlSchemaUtil.CompileID(base.Id, this, schema.IDCollection, h); this.CompilationId = schema.CompilationId; return(this.errorCount); }
///<remarks> /// 1. Base must be present and a QName ///</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 (this.isRedefinedComponent) { if (Annotation != null) { Annotation.isRedefinedComponent = true; } if (AnyAttribute != null) { AnyAttribute.isRedefinedComponent = true; } foreach (XmlSchemaObject obj in Attributes) { obj.isRedefinedComponent = true; } } if (BaseTypeName == null || BaseTypeName.IsEmpty) { error(h, "base must be present, as a QName"); } else if (!XmlSchemaUtil.CheckQName(BaseTypeName)) { error(h, "BaseTypeName must be a QName"); } if (this.AnyAttribute != null) { errorCount += AnyAttribute.Compile(h, schema); } foreach (XmlSchemaObject obj in Attributes) { if (obj is XmlSchemaAttribute) { XmlSchemaAttribute attr = (XmlSchemaAttribute)obj; errorCount += attr.Compile(h, schema); } else if (obj is XmlSchemaAttributeGroupRef) { XmlSchemaAttributeGroupRef atgrp = (XmlSchemaAttributeGroupRef)obj; errorCount += atgrp.Compile(h, schema); } else { error(h, obj.GetType() + " is not valid in this place::SimpleConentExtension"); } } XmlSchemaUtil.CompileID(Id, this, schema.IDCollection, h); this.CompilationId = schema.CompilationId; return(errorCount); }