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 XSElementDeclaration(XmlSchemaElement element)
            : this()
        {
            _element = element;

            if (_element.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }

            if (element.SchemaTypeName is XmlQualifiedName schemaTypeName)
            {
                _typeName = XMLSchemaSerializer.CreateXMLExpandedName(schemaTypeName);
            }

            if (element.RefName is XmlQualifiedName refName)
            {
                _refName = XMLSchemaSerializer.CreateXMLExpandedName(refName);
            }

            if (element.SubstitutionGroup is XmlQualifiedName substitutionGroup)
            {
                _substitutionGroup = XMLSchemaSerializer.CreateXMLExpandedName(substitutionGroup);
            }

            if (_element.SchemaType is XmlSchemaType schemaType)
            {
                _schemaType = XMLSchemaSerializer.CreateIXSType(schemaType);
            }
        }
예제 #3
0
        internal XSModelGroupDefinition(XmlSchemaGroup xmlGroup)
        {
            _group = xmlGroup;
            _name  = xmlGroup.Name;

            if (_group.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }

            if (xmlGroup.Particle is XmlSchemaGroupBase xmlGroupBase)
            {
                IXSComponent component = XMLSchemaSerializer.CreateInstance(xmlGroupBase);

                if (component is XSParticle particle)
                {
                    _modelGroup = particle;
                }

                else if (component is XSModelGroup modelGroup)
                {
                    _modelGroup = modelGroup;
                }
            }
        }
예제 #4
0
        internal XSAttributeDeclaration(XmlSchemaAttribute xmlAttribute)
            : this()
        {
            _attribute = xmlAttribute;

            if (_attribute.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }

            if (_attribute.SchemaTypeName is XmlQualifiedName schemaTypeName)
            {
                _typeName = XMLSchemaSerializer.CreateXMLExpandedName(schemaTypeName);
            }

            if (_attribute.RefName is XmlQualifiedName refName)
            {
                _refName = XMLSchemaSerializer.CreateXMLExpandedName(refName);
            }

            if (_attribute.SchemaType is XmlSchemaSimpleType schemaType)
            {
                _schemaType = XMLSchemaSerializer.CreateXSSimpleTypeDefinition(schemaType);
            }
        }
        internal XSWhitespaceFacet(XmlSchemaWhiteSpaceFacet whitespaceFacet)
        {
            _facet = whitespaceFacet;

            if (_facet.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }
        }
예제 #6
0
        internal XSPatternFacet(XmlSchemaPatternFacet patternFacet)
        {
            _facet = patternFacet;

            if (_facet.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }
        }
예제 #7
0
        internal XSTotalDigitsFacet(XmlSchemaTotalDigitsFacet totalDigitsFacet)
        {
            _facet = totalDigitsFacet;

            if (_facet.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }
        }
예제 #8
0
        internal XSNotationDeclaration(XmlSchemaNotation xmlNotation)
        {
            _notation = xmlNotation;

            if (_notation.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }
        }
예제 #9
0
        internal XSMinLengthFacet(XmlSchemaMinLengthFacet minLengthFacet)
        {
            _facet = minLengthFacet;

            if (_facet.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }
        }
예제 #10
0
        internal XSEnumerationFacet(XmlSchemaEnumerationFacet enumerationFacet)
        {
            _facet = enumerationFacet;
            _value = ValueFactory.Create(_facet.Value);

            if (_facet.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }
        }
        internal XSMinInclusiveFacet(XmlSchemaMinInclusiveFacet minInclusiveFacet)
        {
            _facet = minInclusiveFacet;
            _value = ValueFactory.Create(_facet.Value);

            if (_facet.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }
        }
        internal XSSimpleTypeDefinition(XmlSchemaSimpleType simpleType)
            : this()
        {
            _type = simpleType;

            if (_type.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }

            if (_type.Content is XmlSchemaSimpleTypeList typeList)
            {
                _variety = XSSimpleTypeVariety.List;

                if (typeList.ItemTypeName is XmlQualifiedName qualifiedName)
                {
                    _itemTypeName = new XMLExpandedName(qualifiedName);
                }
            }
            else if (_type.Content is XmlSchemaSimpleTypeUnion typeUnion)
            {
                _variety = XSSimpleTypeVariety.Union;

                MemberTypeDefinitions.Inserted -= MemberTypeDefinitions_Inserted;
                foreach (XmlSchemaObject item in typeUnion.BaseTypes)
                {
                    IXSComponent component = XMLSchemaSerializer.CreateInstance(item);
                    component.BindToContainer(RootContainer, this);
                    MemberTypeDefinitions.Add(component);
                    Components.Add(component);
                }
                MemberTypeDefinitions.Inserted += MemberTypeDefinitions_Inserted;
            }
            else if (_type.Content is XmlSchemaSimpleTypeRestriction typeRestriction)
            {
                _variety = XSSimpleTypeVariety.Atomic;

                if (typeRestriction.BaseTypeName is XmlQualifiedName qualifiedName)
                {
                    _baseTypeName = new XMLExpandedName(qualifiedName);
                }

                Facets.Inserted -= Facets_Inserted;
                foreach (XmlSchemaObject item in typeRestriction.Facets)
                {
                    IXSComponent component = XMLSchemaSerializer.CreateInstance(item);
                    component.BindToContainer(RootContainer, this);
                    Facets.Add(component);
                    Components.Add(component);
                }
                Facets.Inserted += Facets_Inserted;
            }
        }
예제 #13
0
        internal XSModelGroupDefinition(XmlSchemaGroupRef xmlGroupRef)
        {
            _group = xmlGroupRef;

            if (_group.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }

            if (xmlGroupRef.RefName is XmlQualifiedName qualifiedName)
            {
                _reference = XMLSchemaSerializer.CreateXMLExpandedName(qualifiedName);
            }
        }
예제 #14
0
        internal XSAnnotation(XmlSchemaAnnotation annotation)
            : this()
        {
            InternalObject = annotation;

            Content.Inserted -= Content_Inserted;
            foreach (XmlSchemaObject item in InternalObject.Items)
            {
                IXSComponent component = XMLSchemaSerializer.CreateInstance(item);
                component.BindToContainer(RootContainer, this);
                Content.Add(component);
                Components.Add(component);
            }
            Content.Inserted += Content_Inserted;
        }
예제 #15
0
        internal XSWildcard(XmlSchemaAnyAttribute xmlAnyAttribute)
        {
            _wildcard = xmlAnyAttribute;

            if (_wildcard.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }

            _processContents = (XSProcessContents)xmlAnyAttribute.ProcessContents;
            _namespace = xmlAnyAttribute.Namespace;

            SetNamespaceConstraint();
        }
예제 #16
0
        internal XSRedefine(XmlSchemaRedefine redefine)
            : this()
        {
            _redefine = redefine;

            Content.Inserted -= Content_Inserted;
            Content.Cleared  -= Content_Cleared;

            foreach (XmlSchemaObject xmlObject in _redefine.Items)
            {
                IXSComponent component = XMLSchemaSerializer.CreateInstance(xmlObject);

                component.BindToContainer(RootContainer, this);
                Components.Add(component);
                Content.Add(component);
            }

            Content.Inserted += Content_Inserted;
            Content.Cleared  += Content_Cleared;
        }
예제 #17
0
        internal XSParticle(XmlSchemaParticle particle)
            : this()
        {
            if (!string.IsNullOrEmpty(particle.MinOccursString))
            {
                _minOccurs = ValueFactory.Create(particle.MinOccurs);
            }

            if (particle.MaxOccursString == XS_UNBOUNDED)
            {
                _maxOccurs = ValueFactory.Create(decimal.MinusOne);
            }

            else if (!string.IsNullOrEmpty(particle.MaxOccursString))
            {
                _minOccurs = ValueFactory.Create(particle.MaxOccurs);
            }

            _term = XMLSchemaSerializer.CreateIXSFragment(particle);
        }
예제 #18
0
        internal XSModelGroup(XmlSchemaGroupBase groupBase)
            : this()
        {
            _group = groupBase;

            if (_group.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }

            if (groupBase is XmlSchemaAll)
            {
                _compositor = XSCompositor.All;
            }

            else if (groupBase is XmlSchemaChoice)
            {
                _compositor = XSCompositor.Choice;
            }

            else if (groupBase is XmlSchemaSequence)
            {
                _compositor = XSCompositor.Sequence;
            }

            Particles.Inserted -= Particles_Inserted;

            foreach (XmlSchemaObject item in _group.Items)
            {
                IXSComponent component = XMLSchemaSerializer.CreateInstance(item);
                component.BindToContainer(RootContainer, this);
                Particles.Add(component);
                Components.Add(component);
            }

            Particles.Inserted += Particles_Inserted;
        }
예제 #19
0
        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;
        }