private void CompileCommon(ValidationEventHandler h, XmlSchema schema, bool refIsNotPresent) { if (refIsNotPresent) { if (Name == null) //a.4, b.1, { error(h, "Required attribute name must be present"); } else if (!XmlSchemaUtil.CheckNCName(Name)) // a.4.2, b1.2 { error(h, "attribute name must be NCName"); } else if (Name == "xmlns") // a.14 , b5 { error(h, "attribute name must not be xmlns"); } else { qualifiedName = new XmlQualifiedName(Name, targetNamespace); } if (SchemaType != null) { if (SchemaTypeName != null && !SchemaTypeName.IsEmpty) // a.8 { error(h, "attribute can't have both a type and <simpleType> content"); } errorCount += SchemaType.Compile(h, schema); } if (SchemaTypeName != null && !XmlSchemaUtil.CheckQName(SchemaTypeName)) { error(h, SchemaTypeName + " is not a valid QName"); } } else { if (RefName == null || RefName.IsEmpty) { throw new InvalidOperationException("Error: Should Never Happen. refname must be present"); } else { qualifiedName = RefName; } } if (AncestorSchema.TargetNamespace == XmlSchema.InstanceNamespace && Name != "nil" && Name != "type" && Name != "schemaLocation" && Name != "noNamespaceSchemaLocation") // a.15, a.16 { error(h, "targetNamespace can't be " + XmlSchema.InstanceNamespace); } if (DefaultValue != null && FixedValue != null) // a.6, b.3, c.3 { error(h, "default and fixed must not both be present in an Attribute"); } if (DefaultValue != null && Use != XmlSchemaUse.None && Use != XmlSchemaUse.Optional) { error(h, "if default is present, use must be optional"); } XmlSchemaUtil.CompileID(Id, this, schema.IDCollection, h); }