internal XSAttributeGroupDefinition(XmlSchemaAttributeGroup xmlAttributeGroup) : this() { _attributeGroup = xmlAttributeGroup; _name = xmlAttributeGroup.Name; if (_attributeGroup.Annotation is XmlSchemaAnnotation annotation) { _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation); _annotation.BindToContainer(RootContainer, this); } if (xmlAttributeGroup.AnyAttribute is XmlSchemaAnyAttribute xmlAnyAttribute) { _wildcard = XMLSchemaSerializer.CreateXSWildcard(xmlAnyAttribute); } Content.Inserted -= Content_Inserted; foreach (XmlSchemaObject item in xmlAttributeGroup.Attributes) { IXSComponent component = XMLSchemaSerializer.CreateInstance(item); component.BindToContainer(RootContainer, this); Content.Add(component); Components.Add(component); } Content.Inserted += Content_Inserted; }
internal XSComplexTypeDefinition(XmlSchemaComplexType complexType) : this() { _type = complexType; if (_type.Annotation is XmlSchemaAnnotation annotation) { _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation); _annotation.BindToContainer(RootContainer, this); } if (_type.ContentModel is XmlSchemaSimpleContent simpleContent) { _contentModel = XSContentModel.Simple; if (simpleContent.Content is XmlSchemaSimpleContentExtension contentExtension) { _derivationMethod = XSDerivationMethod.Extension; if (contentExtension.BaseTypeName is XmlQualifiedName qualifiedName) { _baseTypeName = XMLSchemaSerializer.CreateXMLExpandedName(qualifiedName); } if (contentExtension.AnyAttribute is XmlSchemaAnyAttribute anyAttribute) { _attributeWildcard = XMLSchemaSerializer.CreateXSWildcard(anyAttribute); } } else if (simpleContent.Content is XmlSchemaSimpleContentRestriction contentRestriction) { _derivationMethod = XSDerivationMethod.Restriction; if (contentRestriction.BaseTypeName is XmlQualifiedName qualifiedName) { _baseTypeName = XMLSchemaSerializer.CreateXMLExpandedName(qualifiedName); } if (contentRestriction.AnyAttribute is XmlSchemaAnyAttribute anyAttribute) { _attributeWildcard = XMLSchemaSerializer.CreateXSWildcard(anyAttribute); } } else { _derivationMethod = XSDerivationMethod.EmptyRef; } if (_type.Particle is XmlSchemaParticle particle) { _content = XMLSchemaSerializer.CreateInstance(particle); } } else if (_type.ContentModel is XmlSchemaComplexContent complexContent) { _contentModel = XSContentModel.Complex; if (complexContent.Content is XmlSchemaComplexContentExtension contentExtension) { _derivationMethod = XSDerivationMethod.Extension; if (contentExtension.BaseTypeName is XmlQualifiedName qualifiedName) { _baseTypeName = XMLSchemaSerializer.CreateXMLExpandedName(qualifiedName); } if (contentExtension.Particle is XmlSchemaParticle particle) { _content = XMLSchemaSerializer.CreateInstance(particle); } if (contentExtension.AnyAttribute is XmlSchemaAnyAttribute anyAttribute) { _attributeWildcard = XMLSchemaSerializer.CreateXSWildcard(anyAttribute); } } else if (complexContent.Content is XmlSchemaComplexContentRestriction contentRestriction) { _derivationMethod = XSDerivationMethod.Restriction; if (contentRestriction.BaseTypeName is XmlQualifiedName qualifiedName) { _baseTypeName = XMLSchemaSerializer.CreateXMLExpandedName(qualifiedName); } if (contentRestriction.Particle is XmlSchemaParticle particle) { _content = XMLSchemaSerializer.CreateInstance(particle); } if (contentRestriction.AnyAttribute is XmlSchemaAnyAttribute anyAttribute) { _attributeWildcard = XMLSchemaSerializer.CreateXSWildcard(anyAttribute); } } else { _derivationMethod = XSDerivationMethod.EmptyRef; if (_type.Particle is XmlSchemaParticle particle) { _content = XMLSchemaSerializer.CreateInstance(particle); } } } else { _contentModel = XSContentModel.EmptyRef; if (_type.Particle is XmlSchemaParticle particle) { _content = XMLSchemaSerializer.CreateInstance(particle); } } Attributes.Inserted -= Attributes_Inserted; foreach (XmlSchemaObject item in _type.Attributes) { IXSComponent component = XMLSchemaSerializer.CreateInstance(item); component.BindToContainer(RootContainer, this); Attributes.Add(component); Components.Add(component); } Attributes.Inserted += Attributes_Inserted; }