// 1. name must be present // 2. MinOccurs & MaxOccurs of the Particle must be absent internal override int Compile(ValidationEventHandler h, XmlSchema schema) { // If this is already compiled this time, simply skip. if (CompilationId == schema.CompilationId) { return(0); } if (Name == null) { error(h, "Required attribute name must be present"); } else if (!XmlSchemaUtil.CheckNCName(this.name)) { error(h, "attribute name must be NCName"); } else { qualifiedName = new XmlQualifiedName(Name, AncestorSchema.TargetNamespace); } if (Particle == null) { error(h, "Particle is required"); } else { if (Particle.MaxOccursString != null) { Particle.error(h, "MaxOccurs must not be present when the Particle is a child of Group"); } if (Particle.MinOccursString != null) { Particle.error(h, "MinOccurs must not be present when the Particle is a child of Group"); } Particle.Compile(h, schema); } XmlSchemaUtil.CompileID(Id, this, schema.IDCollection, h); this.CompilationId = schema.CompilationId; return(errorCount); }
public ElementMetadata Build() { var schema = _localName is null ? null : new SchemaAttrAttribute(_nsId, _localName); var lookup = _children is null ? _lazy : new Lazy <ElementLookup>(() => new ElementLookup(_children.Select(c => c.Build())), true); return(new ElementMetadata(BuildAttributes(), GetValidators(), Availability, schema, Particle.Compile(), lookup)); }
public ElementMetadata Build() { var lookup = _children is null ? _lazy : new Lazy <ElementLookup>(() => new ElementLookup(_children.Select(c => c.Build())), true); return(new ElementMetadata(BuildAttributes(), GetValidators(), _constraints?.ToArray(), Availability, _qname, Particle.Compile(), lookup)); }
public ElementMetadata Build() { var schema = _localName is null ? default : new OpenXmlSchema(_nsId, _localName); var lookup = _children is null ? _lazy : new Lazy <ElementLookup>(() => new ElementLookup(_children.Select(c => c.Build())), true); return(new ElementMetadata(BuildAttributes(), GetValidators(), _constraints?.ToArray(), Availability, schema, Particle.Compile(), lookup)); }