Beispiel #1
0
        private double text = double.NaN;               // double for future generalization

        #region constructors

        public IntBox()
        {
            baseSchema = new XmlSchema();

            //<xs:complexType name="IntBoxN"> first time is empty
            XmlSchemaComplexType newType = new XmlSchemaComplexType();

            newType.Name = "";
            baseSchema.Items.Add(newType);

            //<xs:complexContent>
            XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();

            newType.ContentModel = complexContent;

            //<xs:extension base="IntBox">
            XmlSchemaComplexContentExtension complexContentExtension = new XmlSchemaComplexContentExtension();

            complexContent.Content = complexContentExtension;
            complexContentExtension.BaseTypeName = new XmlQualifiedName("IntBox");

            //<xs:sequence>
            XmlSchemaSequence seq = new XmlSchemaSequence();

            complexContentExtension.Particle = seq;

            //<xs:element name="Value" type="xs:integer"/>
            XmlSchemaElement elem = new XmlSchemaElement();

            seq.Items.Add(elem);
            elem.Name           = "Value";
            elem.SchemaTypeName = new XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema");
        }
Beispiel #2
0
        public FiscalCode()
        {
            baseSchema = new XmlSchema();

            //<xs:complexType name="FiscalCodeN">
            XmlSchemaComplexType newType = new XmlSchemaComplexType();

            // the name must be filled later
            newType.Name = "";
            baseSchema.Items.Add(newType);

            //<xs:complexContent>
            XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();

            newType.ContentModel = complexContent;

            //<xs:extension base="FiscalCode">
            XmlSchemaComplexContentExtension complexContentExtension = new XmlSchemaComplexContentExtension();

            complexContent.Content = complexContentExtension;
            complexContentExtension.BaseTypeName = new XmlQualifiedName("FiscalCode");

            //<xs:sequence>
            XmlSchemaSequence seq = new XmlSchemaSequence();

            complexContentExtension.Particle = seq;

            //<xs:element name="Value" type="xs:string"/>
            XmlSchemaElement elem = new XmlSchemaElement();

            seq.Items.Add(elem);
            elem.Name           = "Value";
            elem.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
            this.AddPatternConstraint(@"[a-zA-Z]{6}\d\d[a-zA-Z]\d\d[a-zA-Z]\d\d\d[a-zA-Z]");
        }
Beispiel #3
0
        public CheckBoxField()
        {
            baseSchema = new XmlSchema();

            //<xs:complexType name="CheckBoxN">
            XmlSchemaComplexType newType = new XmlSchemaComplexType();

            // the name must be filled later
            newType.Name = "";
            baseSchema.Items.Add(newType);

            //<xs:complexContent>
            XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();

            newType.ContentModel = complexContent;

            //<xs:extension base="CheckBox">
            XmlSchemaComplexContentExtension complexContentExtension = new XmlSchemaComplexContentExtension();

            complexContent.Content = complexContentExtension;
            complexContentExtension.BaseTypeName = new XmlQualifiedName("CheckBoxField");

            //<xs:sequence>
            XmlSchemaSequence seq = new XmlSchemaSequence();

            complexContentExtension.Particle = seq;

            //<xs:element name="Value" type="xs:boolean" defeult="false" />
            XmlSchemaElement elem = new XmlSchemaElement();

            seq.Items.Add(elem);
            elem.Name           = "Value";
            elem.SchemaTypeName = new XmlQualifiedName("boolean", "http://www.w3.org/2001/XMLSchema");
            elem.DefaultValue   = "false";
        }
Beispiel #4
0
        internal void ReflectStringParametersMessage()
        {
            Message inputMessage = InputMessage;

            foreach (ParameterInfo parameterInfo in Method.InParameters)
            {
                MessagePart part = new MessagePart();
                part.Name = XmlConvert.EncodeLocalName(parameterInfo.Name);
                if (parameterInfo.ParameterType.IsArray)
                {
                    string typeNs = DefaultNamespace;
                    if (typeNs.EndsWith("/", StringComparison.Ordinal))
                    {
                        typeNs += "AbstractTypes";
                    }
                    else
                    {
                        typeNs += "/AbstractTypes";
                    }
                    string typeName = "StringArray";
                    if (!ServiceDescription.Types.Schemas.Contains(typeNs))
                    {
                        XmlSchema schema = new XmlSchema();
                        schema.TargetNamespace = typeNs;
                        ServiceDescription.Types.Schemas.Add(schema);

                        XmlSchemaElement element = new XmlSchemaElement();
                        element.Name           = "String";
                        element.SchemaTypeName = new XmlQualifiedName("string", XmlSchema.Namespace);
                        element.MinOccurs      = decimal.Zero;
                        element.MaxOccurs      = decimal.MaxValue;
                        XmlSchemaSequence all = new XmlSchemaSequence();
                        all.Items.Add(element);

                        XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction();
                        restriction.BaseTypeName = new XmlQualifiedName(Soap.ArrayType, Soap.Encoding);
                        restriction.Particle     = all;

                        XmlSchemaImport import = new XmlSchemaImport();
                        import.Namespace = restriction.BaseTypeName.Namespace;

                        XmlSchemaComplexContent model = new XmlSchemaComplexContent();
                        model.Content = restriction;

                        XmlSchemaComplexType type = new XmlSchemaComplexType();
                        type.Name         = typeName;
                        type.ContentModel = model;

                        schema.Items.Add(type);
                        schema.Includes.Add(import);
                    }
                    part.Type = new XmlQualifiedName(typeName, typeNs);
                }
                else
                {
                    part.Type = new XmlQualifiedName("string", XmlSchema.Namespace);
                }
                inputMessage.Parts.Add(part);
            }
        }
Beispiel #5
0
        public static IEnumerable <XmlSchemaElement> LocalXsdElements(this XmlSchemaType ty)
        {
            XmlSchemaComplexType iteratorVariable0 = ty as XmlSchemaComplexType;

            if (iteratorVariable0 != null)
            {
                if (iteratorVariable0.ContentModel != null)
                {
                    XmlSchemaComplexContent contentModel = iteratorVariable0.ContentModel as XmlSchemaComplexContent;
                    if (contentModel != null)
                    {
                        XmlSchemaComplexContentExtension content = contentModel.Content as XmlSchemaComplexContentExtension;
                        if (content != null)
                        {
                            foreach (XmlSchemaElement iteratorVariable4 in content.Particle.LocalXsdElements())
                            {
                                yield return(iteratorVariable4);
                            }
                        }
                    }
                }
                else
                {
                    foreach (XmlSchemaElement iteratorVariable1 in iteratorVariable0.Particle.LocalXsdElements())
                    {
                        yield return(iteratorVariable1);
                    }
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColorPicker"/> class.
        /// </summary>
        public ColorPicker()
        {
            baseSchema = new XmlSchema();

            //<xs:complexType name="ColorPickerN">
            XmlSchemaComplexType newType = new XmlSchemaComplexType();

            // the name must be filled later
            newType.Name = "";
            baseSchema.Items.Add(newType);

            //<xs:complexContent>
            XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();

            newType.ContentModel = complexContent;

            //<xs:extension base="ColorPicker">
            XmlSchemaComplexContentExtension complexContentExtension = new XmlSchemaComplexContentExtension();

            complexContent.Content = complexContentExtension;
            complexContentExtension.BaseTypeName = new XmlQualifiedName("ColorPicker");

            //<xs:sequence>
            XmlSchemaSequence seq = new XmlSchemaSequence();

            complexContentExtension.Particle = seq;

            //<xs:element name="Value" type="xs:string"/>
            XmlSchemaElement elem = new XmlSchemaElement();

            seq.Items.Add(elem);
            elem.Name           = "Value";
            elem.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
        }
        static XmlSchemaType AddElementTypeToXmlSchema(IUxmlFactory factory, SchemaInfo schemaInfo, FactoryProcessingHelper processingData)
        {
            // We always have complex types with complex content.
            XmlSchemaComplexType elementType = new XmlSchemaComplexType();

            elementType.Name = factory.uxmlName + k_TypeSuffix;

            XmlSchemaComplexContent content = new XmlSchemaComplexContent();

            elementType.ContentModel = content;

            // We only support restrictions of base types.
            XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction();

            content.Content = restriction;

            if (factory.substituteForTypeName == String.Empty)
            {
                restriction.BaseTypeName = new XmlQualifiedName("anyType", k_XmlSchemaNamespace);
            }
            else
            {
                restriction.BaseTypeName = new XmlQualifiedName(factory.substituteForTypeName + k_TypeSuffix, factory.substituteForTypeNamespace);
                schemaInfo.importNamespaces.Add(factory.substituteForTypeNamespace);
            }

            if (factory.canHaveAnyAttribute)
            {
                XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute();
                anyAttribute.ProcessContents = XmlSchemaContentProcessing.Lax;
                restriction.AnyAttribute     = anyAttribute;
            }

            foreach (UxmlAttributeDescription attrDesc in factory.uxmlAttributesDescription)
            {
                XmlQualifiedName typeName = AddAttributeTypeToXmlSchema(schemaInfo, attrDesc, factory, processingData);
                if (typeName != null)
                {
                    AddAttributeToXmlSchema(restriction, attrDesc, typeName);
                    schemaInfo.importNamespaces.Add(attrDesc.typeNamespace);
                }
            }

            bool hasChildElements = false;

            foreach (UxmlChildElementDescription childDesc in factory.uxmlChildElementsDescription)
            {
                hasChildElements = true;
                schemaInfo.importNamespaces.Add(childDesc.elementNamespace);
            }

            if (hasChildElements)
            {
                restriction.Particle = MakeChoiceSequence(factory.uxmlChildElementsDescription);
            }

            schemaInfo.schema.Items.Add(elementType);
            return(elementType);
        }
Beispiel #8
0
        public FiscalCode(XmlSchema schema, string name)
        {
            // in this constructor it's useful to set the ID, cause GUI is calling it
            this.Name = name;

            baseSchema = new XmlSchema();

            //<xs:complexType name="FiscalCodeN">
            XmlSchemaComplexType newType = new XmlSchemaComplexType();

            newType.Name = ((XmlSchemaComplexType)schema.Items[0]).Name;
            baseSchema.Items.Add(newType);

            //<xs:complexContent>
            XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();

            newType.ContentModel = complexContent;

            //<xs:extension base="FiscalCode">
            XmlSchemaComplexContentExtension complexContentExtension = new XmlSchemaComplexContentExtension();

            complexContent.Content = complexContentExtension;
            complexContentExtension.BaseTypeName = new XmlQualifiedName("FiscalCode");

            //<xs:sequence>
            XmlSchemaSequence seq = new XmlSchemaSequence();

            complexContentExtension.Particle = seq;

            //<xs:element name="Value" type="xs:string"/>
            XmlSchemaElement elem = new XmlSchemaElement();

            seq.Items.Add(elem);
            elem.Name           = "Value";
            elem.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");

            //check empty element value
            if (Common.getElementFromSchema(schema).IsNillable)
            {
                elem.IsNillable = true;
            }

            if (((XmlSchemaSimpleType)Common.getElementFromSchema(schema).SchemaType) == null)
            {
                return;
            }
            XmlSchemaObjectCollection constrColl =
                ((XmlSchemaSimpleTypeRestriction)
                 ((XmlSchemaSimpleType)
                  Common.getElementFromSchema(schema)
                  .SchemaType).Content).Facets;


            foreach (XmlSchemaFacet facet in constrColl)
            {
                Common.addFacet(facet, Common.getElementFromSchema(baseSchema));
            }
        }
Beispiel #9
0
        public IntBox(XmlSchema schema, string name)
        {
            this.Name = name;

            baseSchema = new XmlSchema();

            //<xs:complexType name="IntBoxN">
            XmlSchemaComplexType newType = new XmlSchemaComplexType();

            newType.Name = ((XmlSchemaComplexType)schema.Items[0]).Name;
            baseSchema.Items.Add(newType);

            //<xs:complexContent>
            XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();

            newType.ContentModel = complexContent;

            //<xs:extension base="IntBox">
            XmlSchemaComplexContentExtension complexContentExtension = new XmlSchemaComplexContentExtension();

            complexContent.Content = complexContentExtension;
            complexContentExtension.BaseTypeName = new XmlQualifiedName("IntBox");

            //<xs:sequence>
            XmlSchemaSequence seq = new XmlSchemaSequence();

            complexContentExtension.Particle = seq;

            //<xs:element name="Value" type="xs:integer"/>
            XmlSchemaElement elem = new XmlSchemaElement();

            seq.Items.Add(elem);
            elem.Name           = "Value";
            elem.SchemaTypeName = new XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema");

            //Controlla se l'element potra' avere valore vuoto
            if (Common.getElementFromSchema(schema).IsNillable)
            {
                elem.IsNillable = true;
            }

            // TODO: find another way to get Items[0], it is not correct.
            if (((XmlSchemaSimpleType)Common.getElementFromSchema(schema).SchemaType) == null)
            {
                return;
            }
            XmlSchemaObjectCollection constrColl =
                ((XmlSchemaSimpleTypeRestriction)
                 ((XmlSchemaSimpleType)
                  Common.getElementFromSchema(schema)
                  .SchemaType).Content).Facets;

            foreach (XmlSchemaFacet facet in constrColl)
            {
                Common.addFacet(facet, Common.getElementFromSchema(baseSchema));
            }
        }
Beispiel #10
0
        private void CopyDataType(XmlSchemaComplexType complexType)
        {
            if (FindDataType(destinationSchema, complexType.Name) != null)
            {
                return;
            }

            XmlSchemaComplexType newComplexType = new XmlSchemaComplexType()
            {
                Name       = complexType.Name,
                IsMixed    = complexType.IsMixed,
                IsAbstract = complexType.IsAbstract,
            };

            destinationSchema.Items.Add(newComplexType);

            // Add annotation to indicate where it was copied from
            newComplexType.Annotation = CreateAnnotation("Data type copied from base schema (" + sourceSchema.TargetNamespace + ")");

            // Copy children
            XmlSchemaSequence       particleSequence = complexType.Particle as XmlSchemaSequence;
            XmlSchemaComplexContent complexContent   = complexType.ContentModel as XmlSchemaComplexContent;

            if (particleSequence != null)
            {
                XmlSchemaSequence newParticleSequence = new XmlSchemaSequence();
                newComplexType.Particle = newParticleSequence;

                foreach (var currentObject in particleSequence.Items)
                {
                    if (currentObject is XmlSchemaElement)
                    {
                        XmlSchemaElement newElement = Copy(currentObject as XmlSchemaElement);
                        newParticleSequence.Items.Add(newElement);
                    }
                }
            }
            else if (complexContent != null)
            {
                XmlSchemaComplexContent newComplexContent = new XmlSchemaComplexContent();
                newComplexType.ContentModel = newComplexContent;
                newComplexContent.IsMixed   = complexContent.IsMixed;

                if (complexContent.Content != null)
                {
                    XmlSchemaContent newContent = Copy(complexContent.Content);
                    newComplexContent.Content = newContent;
                }
            }

            foreach (var attribute in complexType.Attributes.Cast <XmlSchemaAttribute>())
            {
                XmlSchemaAttribute newAttribute = this.Copy(attribute);
                newComplexType.Attributes.Add(newAttribute);
            }
        }
        XmlQualifiedName ExportArrayMapping(ArrayMapping mapping, string ns)
        {
            // for the Rpc ArrayMapping  different mappings could have the same schema type
            // we link all mappings corresponding to the same type together
            // loop through all mapping that will map to the same complexType, and export only one,
            // the obvious choice is the last one.
            while (mapping.Next != null)
            {
                mapping = mapping.Next;
            }

            XmlSchemaComplexType type = (XmlSchemaComplexType)types[mapping];

            if (type == null)
            {
                CheckForDuplicateType(mapping.TypeName, mapping.Namespace);
                type      = new XmlSchemaComplexType();
                type.Name = mapping.TypeName;
                types.Add(mapping, type);

                // we need to add the type first, to make sure that the schema get created
                AddSchemaItem(type, mapping.Namespace, ns);
                AddSchemaImport(Soap.Encoding, mapping.Namespace);
                AddSchemaImport(Wsdl.Namespace, mapping.Namespace);

                XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction();
                XmlQualifiedName qname = ExportTypeMapping(mapping.Elements[0].Mapping, mapping.Namespace);

                if (qname.IsEmpty)
                {
                    // this is a root mapping
                    qname = new XmlQualifiedName(Soap.UrType, XmlSchema.Namespace);
                }
                //<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:float[]"/>
                XmlSchemaAttribute attr = new XmlSchemaAttribute();
                attr.RefName = ArrayTypeQName;
                XmlAttribute attribute = new XmlAttribute("wsdl", Wsdl.ArrayType, Wsdl.Namespace, Document);
                attribute.Value = qname.Namespace + ":" + qname.Name + "[]";

                attr.UnhandledAttributes = new XmlAttribute[] { attribute };
                restriction.Attributes.Add(attr);
                restriction.BaseTypeName = ArrayQName;
                XmlSchemaComplexContent model = new XmlSchemaComplexContent();
                model.Content     = restriction;
                type.ContentModel = model;
                if (qname.Namespace != XmlSchema.Namespace)
                {
                    AddSchemaImport(qname.Namespace, mapping.Namespace);
                }
            }
            else
            {
                AddSchemaImport(mapping.Namespace, ns);
            }
            return(new XmlQualifiedName(mapping.TypeName, mapping.Namespace));
        }
Beispiel #12
0
        XmlQualifiedName ExportStructMapping(StructMapping mapping, string ns)
        {
            if (mapping.TypeDesc.IsRoot)
            {
                needToExportRoot = true;
                return(XmlQualifiedName.Empty);
            }
            XmlSchemaComplexType type = (XmlSchemaComplexType)types[mapping];

            if (type == null)
            {
                if (!mapping.IncludeInSchema)
                {
                    throw new InvalidOperationException(Res.GetString(Res.XmlCannotIncludeInSchema, mapping.TypeDesc.Name));
                }
                CheckForDuplicateType(mapping.TypeName, mapping.Namespace);
                type      = new XmlSchemaComplexType();
                type.Name = mapping.TypeName;
                types.Add(mapping, type);
                AddSchemaItem(type, mapping.Namespace, ns);
                type.IsAbstract = mapping.TypeDesc.IsAbstract;

                if (mapping.BaseMapping != null && mapping.BaseMapping.IncludeInSchema)
                {
                    if (mapping.HasSimpleContent)
                    {
                        XmlSchemaSimpleContent          model     = new XmlSchemaSimpleContent();
                        XmlSchemaSimpleContentExtension extension = new XmlSchemaSimpleContentExtension();
                        extension.BaseTypeName = ExportStructMapping(mapping.BaseMapping, mapping.Namespace);
                        model.Content          = extension;
                        type.ContentModel      = model;
                    }
                    else
                    {
                        XmlSchemaComplexContentExtension extension = new XmlSchemaComplexContentExtension();
                        extension.BaseTypeName = ExportStructMapping(mapping.BaseMapping, mapping.Namespace);
                        XmlSchemaComplexContent model = new XmlSchemaComplexContent();
                        model.Content     = extension;
                        model.IsMixed     = XmlSchemaImporter.IsMixed((XmlSchemaComplexType)types[mapping.BaseMapping]);
                        type.ContentModel = model;
                    }
                }
                ExportTypeMembers(type, mapping.Members, mapping.TypeName, mapping.Namespace, mapping.HasSimpleContent);
                ExportDerivedMappings(mapping);
                if (mapping.XmlnsMember != null)
                {
                    AddXmlnsAnnotation(type, mapping.XmlnsMember.Name);
                }
            }
            else
            {
                AddSchemaImport(mapping.Namespace, ns);
            }
            return(new XmlQualifiedName(type.Name, mapping.Namespace));
        }
Beispiel #13
0
        public RadioButtonList(XmlSchema schema, string name)
        {
            this.Name = name;

            baseSchema = new XmlSchema();

            XmlSchemaComplexType ctype = new XmlSchemaComplexType();

            ctype.Name = ((XmlSchemaComplexType)schema.Items[0]).Name;
            baseSchema.Items.Add(ctype);

            XmlSchemaComplexContent          complexContent          = new XmlSchemaComplexContent();
            XmlSchemaComplexContentExtension complexContentExtension = new XmlSchemaComplexContentExtension();

            complexContentExtension.BaseTypeName = new XmlQualifiedName("RadioButtonList");

            ctype.ContentModel     = complexContent;
            complexContent.Content = complexContentExtension;

            XmlSchemaSequence seq = new XmlSchemaSequence();

            complexContentExtension.Particle = seq;

            XmlSchemaElement elem = new XmlSchemaElement();

            elem.Name = "Value";
            seq.Items.Add(elem);

            if (Common.getElementFromSchema(schema).IsNillable)
            {
                elem.IsNillable = true;
            }

            XmlSchemaSimpleType            simpleType  = new XmlSchemaSimpleType();
            XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();

            restriction.BaseTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");

            elem.SchemaType    = simpleType;
            simpleType.Content = restriction;
            //for direct access
            elemPointer = elem;

            //addning enumerations
            XmlSchemaElement schemaElem = ((XmlSchemaElement)((XmlSchemaSequence)((XmlSchemaComplexContentExtension)((XmlSchemaComplexContent)((XmlSchemaComplexType)schema.Items[0]).ContentModel).Content).Particle).Items[0]);
            XmlSchemaSimpleTypeRestriction schemaRestriction = ((XmlSchemaSimpleTypeRestriction)((XmlSchemaSimpleType)schemaElem.SchemaType).Content);

            foreach (XmlSchemaFacet i in schemaRestriction.Facets)
            {
                XmlSchemaEnumerationFacet enumeration = new XmlSchemaEnumerationFacet();
                enumeration.Value = i.Value;
                restriction.Facets.Add(enumeration);
            }
        }
Beispiel #14
0
        static void AddAppSequenceType(DiscoveryVersion discoveryVersion, XmlSchema schema)
        {
            //<xs:complexType name="AppSequenceType" >
            XmlSchemaComplexType appSequenceType = new XmlSchemaComplexType();

            appSequenceType.Name = ProtocolStrings.SchemaNames.AppSequenceType;

            // <xs:complexContent>
            XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();

            appSequenceType.ContentModel = complexContent;

            // <xs:restriction base="xs:anyType" >
            XmlSchemaComplexContentRestriction contentRestriction = new XmlSchemaComplexContentRestriction();

            complexContent.Content          = contentRestriction;
            contentRestriction.BaseTypeName = discoveryVersion.Implementation.QualifiedNames.AnyType;

            // <xs:attribute name="InstanceId" type="xs:unsignedInt" use="required" />
            XmlSchemaAttribute instanceId = new XmlSchemaAttribute();

            instanceId.Name           = ProtocolStrings.SchemaNames.AppSequenceInstanceId;
            instanceId.SchemaTypeName = discoveryVersion.Implementation.QualifiedNames.UnsignedIntType;
            instanceId.Use            = XmlSchemaUse.Required;

            // <xs:attribute name="SequenceId" type="xs:anyURI" />
            XmlSchemaAttribute sequenceId = new XmlSchemaAttribute();

            sequenceId.Name           = ProtocolStrings.SchemaNames.AppSequenceSequenceId;
            sequenceId.SchemaTypeName = discoveryVersion.Implementation.QualifiedNames.AnyUriType;

            // <xs:attribute name="MessageNumber" type="xs:unsignedInt" use="required" />
            XmlSchemaAttribute messageNumber = new XmlSchemaAttribute();

            messageNumber.Name           = ProtocolStrings.SchemaNames.AppSequenceMessageNumber;
            messageNumber.SchemaTypeName = discoveryVersion.Implementation.QualifiedNames.UnsignedIntType;
            messageNumber.Use            = XmlSchemaUse.Required;

            // <xs:anyAttribute namespace="##other" processContents="lax" />
            XmlSchemaAnyAttribute anyAttribue = new XmlSchemaAnyAttribute();

            anyAttribue.Namespace       = "##other";
            anyAttribue.ProcessContents = XmlSchemaContentProcessing.Lax;

            contentRestriction.Attributes.Add(instanceId);
            contentRestriction.Attributes.Add(sequenceId);
            contentRestriction.Attributes.Add(messageNumber);
            contentRestriction.AnyAttribute = anyAttribue;

            schema.Items.Add(appSequenceType);
        }
Beispiel #15
0
 protected virtual void WriteContentModel(XmlSchemaComplexType type,
                                          XmlWriter writer)
 {
     if (type.ContentModel != null)
     {
         if (type.ContentModel is XmlSchemaSimpleContent)
         {
             XmlSchemaSimpleContent            content     = type.ContentModel as XmlSchemaSimpleContent;
             XmlSchemaSimpleContentRestriction restriction =
                 content.Content as XmlSchemaSimpleContentRestriction;
             if (restriction != null)
             {
                 WriteExampleValue(type.QualifiedName.Name, restriction.BaseType, writer);
             }
             else
             {
                 XmlSchemaSimpleContentExtension extension =
                     content.Content as XmlSchemaSimpleContentExtension;
             }
         }
         else if (type.Particle == null && type.ContentModel is XmlSchemaComplexContent)
         {
             XmlSchemaComplexContent complexContent =
                 type.ContentModel as XmlSchemaComplexContent;
             XmlSchemaComplexContentExtension ext =
                 type.ContentModel.Content as XmlSchemaComplexContentExtension;
             if (type.BaseXmlSchemaType != null)
             {
                 XmlSchemaComplexType baseType =
                     type.BaseXmlSchemaType as XmlSchemaComplexType;
                 if (baseType != null)
                 {
                     WriteContentModel(baseType, writer);
                 }
             }
             if (ext != null && ext.Particle != null)
             {
                 if (ext.BaseTypeName != null)
                 {
                     object ao = Schema.Elements[ext.BaseTypeName];
                     //string data = ao.ToString();
                 }
                 WriteExampleParticle(ext.Particle, writer);
             }
         }
     }
     if (type.Particle != null)
     {
         WriteExampleParticle(type.Particle, writer);
     }
 }
Beispiel #16
0
        private MemberMapping[] ImportTypeMembers(XmlSchemaComplexType type, string typeNs, CodeIdentifiers members)
        {
            if (type.AnyAttribute != null)
            {
                throw new InvalidOperationException(SR.Format(SR.XmlInvalidAnyAttributeUse, type.Name, type.QualifiedName.Namespace));
            }

            XmlSchemaObjectCollection items = type.Attributes;

            for (int i = 0; i < items.Count; i++)
            {
                object item = items[i];
                if (item is XmlSchemaAttributeGroup)
                {
                    throw new InvalidOperationException(SR.Format(SR.XmlSoapInvalidAttributeUse, type.Name, type.QualifiedName.Namespace));
                }
                if (item is XmlSchemaAttribute)
                {
                    XmlSchemaAttribute attr = (XmlSchemaAttribute)item;
                    if (attr.Use != XmlSchemaUse.Prohibited)
                    {
                        throw new InvalidOperationException(SR.Format(SR.XmlSoapInvalidAttributeUse, type.Name, type.QualifiedName.Namespace));
                    }
                }
            }
            if (type.Particle != null)
            {
                ImportGroup(type.Particle, members, typeNs);
            }
            else if (type.ContentModel != null && type.ContentModel is XmlSchemaComplexContent)
            {
                XmlSchemaComplexContent model = (XmlSchemaComplexContent)type.ContentModel;

                if (model.Content is XmlSchemaComplexContentExtension)
                {
                    if (((XmlSchemaComplexContentExtension)model.Content).Particle != null)
                    {
                        ImportGroup(((XmlSchemaComplexContentExtension)model.Content).Particle, members, typeNs);
                    }
                }
                else if (model.Content is XmlSchemaComplexContentRestriction)
                {
                    if (((XmlSchemaComplexContentRestriction)model.Content).Particle != null)
                    {
                        ImportGroup(((XmlSchemaComplexContentRestriction)model.Content).Particle, members, typeNs);
                    }
                }
            }
            return((MemberMapping[])members.ToArray(typeof(MemberMapping)));
        }
Beispiel #17
0
        private void GetProperties(XmlSchema xmlSchema, string elementname)
        {
            foreach (object xItem in xmlSchema.SchemaTypes.Values)
            {
                XmlSchemaComplexType item = xItem as XmlSchemaComplexType;
                #region item
                if (item != null)
                {
                    if (item.Name.Equals(elementname))
                    {
                        XmlSchemaContentModel   model    = item.ContentModel;
                        XmlSchemaComplexContent complex  = model as XmlSchemaComplexContent;
                        SoapClasses             newClass = this.GetClass(elementname);

                        if (complex != null && newClass != null)
                        {
                            XmlSchemaComplexContentExtension extension = complex.Content as XmlSchemaComplexContentExtension;
                            XmlSchemaParticle particle = extension.Particle;
                            XmlSchemaSequence sequence = particle as XmlSchemaSequence;

                            if (extension != null)
                            {
                                newClass.SuperClassType = extension.BaseTypeName.Name;
                            }

                            if (sequence != null)
                            {
                                foreach (XmlSchemaElement childElement in sequence.Items)
                                {
                                    if (newClass != null)
                                    {
                                        SoapClassProperties newProp = new SoapClassProperties(XpoDefault.Session);
                                        newProp.Name = childElement.Name;

                                        newProp.PropertyClassType = childElement.SchemaTypeName.Name;
                                        newProp.IsArray           = childElement.SchemaTypeName.Name.StartsWith("ArrayOf");//.Equals("unbounded"));
                                        newClass.Properties.Add(newProp);
                                    }
                                }
                            }

                            newClass.Save();
                        }
                        return;
                    }
                }
                #endregion
            }
        }
        void Parse_ComplexContent(TreeNode inner, string ns, XmlSchemaComplexContent content)
        {
            XmlQualifiedName qname;

            XmlSchemaComplexContentExtension ext = content.Content as XmlSchemaComplexContentExtension;

            if (ext != null)
            {
                qname = ext.BaseTypeName;
            }
            else
            {
                XmlSchemaComplexContentRestriction rest = (XmlSchemaComplexContentRestriction)content.Content;
                qname = rest.BaseTypeName;
                if (qname == arrayType)
                {
                    Parse_ArrayType(rest, out qname);
                    XmlSchemaElement elem = new XmlSchemaElement();
                    elem.Name           = "Item";
                    elem.SchemaTypeName = qname;

                    TreeNode node = new TreeNode("arrayType" + SoapEncodingNamespace + qname.Name + "[2]");
                    inner.Nodes.Add(node);
                    Add_Item(inner, ns, elem, true);
                    return;
                }
            }



            // Add base map members to this map
            XmlSchemaComplexType ctype = GetComplexTypeByName(qname);

            Add_ComplexAttributes(inner, ctype);
            //Add base content first
            Add_ComplexElements(inner, ns, ctype);

            if (ext != null)
            {
                // Add the members of this map
                Add_Attributes(inner, ext.Attributes, ext.AnyAttribute);
                if (ext.Particle != null)
                {
                    Parse_ParticleComplexContent(inner, ns, ext.Particle);
                }
            }
        }
Beispiel #19
0
        /// <summary>
        /// Creates an element representing a conditional "Switch" block, which recursively contains another type
        /// </summary>
        /// <param name="InnerType">The base type for the do block to contain</param>
        /// <returns>New schema element for the block</returns>
        static XmlSchemaElement CreateSwitchElement(ScriptSchemaStandardType InnerType)
        {
            // Create the "Option" element
            XmlSchemaComplexContentExtension CaseExtension = new XmlSchemaComplexContentExtension();

            CaseExtension.BaseTypeName = GetQualifiedTypeName(InnerType);
            CaseExtension.Attributes.Add(CreateSchemaAttribute("If", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Required));

            XmlSchemaComplexContent CaseContentModel = new XmlSchemaComplexContent();

            CaseContentModel.Content = CaseExtension;

            XmlSchemaComplexType CaseSchemaType = new XmlSchemaComplexType();

            CaseSchemaType.ContentModel = CaseContentModel;

            XmlSchemaElement CaseElement = new XmlSchemaElement();

            CaseElement.Name            = "Case";
            CaseElement.SchemaType      = CaseSchemaType;
            CaseElement.MinOccurs       = 0;
            CaseElement.MaxOccursString = "unbounded";

            // Create the "Otherwise" element
            XmlSchemaElement OtherwiseElement = new XmlSchemaElement();

            OtherwiseElement.Name           = "Default";
            OtherwiseElement.SchemaTypeName = GetQualifiedTypeName(InnerType);
            OtherwiseElement.MinOccurs      = 0;
            OtherwiseElement.MaxOccurs      = 1;

            // Create the "Switch" element
            XmlSchemaSequence SwitchSequence = new XmlSchemaSequence();

            SwitchSequence.Items.Add(CaseElement);
            SwitchSequence.Items.Add(OtherwiseElement);

            XmlSchemaComplexType SwitchSchemaType = new XmlSchemaComplexType();

            SwitchSchemaType.Particle = SwitchSequence;

            XmlSchemaElement SwitchElement = new XmlSchemaElement();

            SwitchElement.Name       = "Switch";
            SwitchElement.SchemaType = SwitchSchemaType;
            return(SwitchElement);
        }
Beispiel #20
0
        /// <summary>
        ///     Handle derivation by extension.
        ///     If type is null, it'll create a new complexType
        ///     with an XmlAny node in its sequence child node.
        /// </summary>
        public XmlSchemaType WriteComplexSchemaType(Type type)
        {
            //
            // Recursively generate schema for all parent types
            //
            if (type != null && type.BaseType == typeof(object))
            {
                return(WriteSchemaType(type));
            }

            XmlSchemaComplexType             complexType = new XmlSchemaComplexType();
            XmlSchemaSequence                sequence;
            XmlSchemaComplexContentExtension extension = new XmlSchemaComplexContentExtension();
            XmlSchemaComplexContent          content   = new XmlSchemaComplexContent();

            complexType.ContentModel = content;
            content.Content          = extension;

            XmlSchemaType baseSchemaType = WriteSchemaType(type.BaseType);

            complexType.Name = type.Name;

            FieldInfo []    fields     = type.GetFields(flags);
            PropertyInfo [] properties = type.GetProperties(flags);

            try {
                sequence = PopulateSequence(fields, properties);
                if (attributes != null)
                {
                    foreach (object o in attributes)
                    {
                        MemberInfo member         = (MemberInfo)o;
                        Type       attribute_type = (Type)attributes [o];

                        complexType.Attributes.Add(WriteSchemaAttribute(member, attribute_type));
                    }
                }
            } catch (ArgumentException e) {
                throw new ArgumentException(String.Format("There is an error in '{0}'\n\t{1}", type.Name, e.Message));
            }

            extension.BaseTypeName = new XmlQualifiedName(baseSchemaType.Name);
            extension.Particle     = sequence;

            generatedSchemaTypes.Add(type.FullName, complexType);
            return(complexType);
        }
 private XmlQualifiedName ExportArrayMapping(ArrayMapping mapping, string ns)
 {
     while (mapping.Next != null)
     {
         mapping = mapping.Next;
     }
     if (((XmlSchemaComplexType)this.types[mapping]) == null)
     {
         this.CheckForDuplicateType(mapping.TypeName, mapping.Namespace);
         XmlSchemaComplexType type = new XmlSchemaComplexType {
             Name = mapping.TypeName
         };
         this.types.Add(mapping, type);
         this.AddSchemaItem(type, mapping.Namespace, ns);
         this.AddSchemaImport("http://schemas.xmlsoap.org/soap/encoding/", mapping.Namespace);
         this.AddSchemaImport("http://schemas.xmlsoap.org/wsdl/", mapping.Namespace);
         XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction();
         XmlQualifiedName name = this.ExportTypeMapping(mapping.Elements[0].Mapping, mapping.Namespace);
         if (name.IsEmpty)
         {
             name = new XmlQualifiedName("anyType", "http://www.w3.org/2001/XMLSchema");
         }
         XmlSchemaAttribute item = new XmlSchemaAttribute {
             RefName = ArrayTypeQName
         };
         XmlAttribute attribute2 = new XmlAttribute("wsdl", "arrayType", "http://schemas.xmlsoap.org/wsdl/", this.Document)
         {
             Value = name.Namespace + ":" + name.Name + "[]"
         };
         item.UnhandledAttributes = new XmlAttribute[] { attribute2 };
         restriction.Attributes.Add(item);
         restriction.BaseTypeName = ArrayQName;
         XmlSchemaComplexContent content = new XmlSchemaComplexContent {
             Content = restriction
         };
         type.ContentModel = content;
         if (name.Namespace != "http://www.w3.org/2001/XMLSchema")
         {
             this.AddSchemaImport(name.Namespace, mapping.Namespace);
         }
     }
     else
     {
         this.AddSchemaImport(mapping.Namespace, ns);
     }
     return(new XmlQualifiedName(mapping.TypeName, mapping.Namespace));
 }
        void GetChildElementCompletionData(XmlCompletionDataList data, XmlSchemaComplexContent complexContent, string prefix)
        {
            var extension = complexContent.Content as XmlSchemaComplexContentExtension;

            if (extension != null)
            {
                GetChildElementCompletionData(data, extension, prefix);
                return;
            }
            var restriction = complexContent.Content as XmlSchemaComplexContentRestriction;

            if (restriction != null)
            {
                GetChildElementCompletionData(data, restriction, prefix);
                return;
            }
        }
Beispiel #23
0
        public static IEnumerable <XmlSchemaAttribute> LocalXsdAttributes(this XmlSchemaType ty)
        {
            XmlSchemaComplexType xmlSchemaComplexType = ty as XmlSchemaComplexType;

            if (xmlSchemaComplexType != null)
            {
                foreach (XmlSchemaAttribute attribute in xmlSchemaComplexType.Attributes)
                {
                    yield return(attribute);
                }
                if (xmlSchemaComplexType.ContentModel != null)
                {
                    XmlSchemaComplexContent contentModel = xmlSchemaComplexType.ContentModel as XmlSchemaComplexContent;
                    if (contentModel != null)
                    {
                        XmlSchemaComplexContentExtension content = contentModel.Content as XmlSchemaComplexContentExtension;
                        if (content == null)
                        {
                            goto Label0;
                        }
                        foreach (XmlSchemaAttribute xmlSchemaAttribute in content.Attributes)
                        {
                            yield return(xmlSchemaAttribute);
                        }
                        foreach (XmlSchemaAttribute xmlSchemaAttribute1 in content.Particle.LocalXsdAttributes())
                        {
                            yield return(xmlSchemaAttribute1);
                        }
                    }
                    else
                    {
                        goto Label0;
                    }
                }
                else
                {
                    foreach (XmlSchemaAttribute xmlSchemaAttribute2 in xmlSchemaComplexType.Particle.LocalXsdAttributes())
                    {
                        yield return(xmlSchemaAttribute2);
                    }
                }
            }
Label0:
            yield break;
            goto Label0;
        }
Beispiel #24
0
        private void setXsd(XmlSchemaComplexType xsCoxType)
        {
            m_ClassGen.CName = xsCoxType.Name;

            if (xsCoxType.ContentModel == null)
            {
                if (xsCoxType.Particle is XmlSchemaGroupRef)
                {
                    // 만듬.
                }

                else if (xsCoxType.Particle is XmlSchemaGroupBase)
                {
                    XmlSchemaGroupBase xgb = xsCoxType.Particle as XmlSchemaGroupBase;
                    roopItem(xgb);
                }
            }

            else if (xsCoxType.ContentModel is XmlSchemaComplexContent)
            {
                XmlSchemaComplexContent xscc = xsCoxType.ContentModel as XmlSchemaComplexContent;

                if (xscc.Content is XmlSchemaComplexContentExtension)
                {
                    XmlSchemaComplexContentExtension xscc_Extension = xscc.Content as XmlSchemaComplexContentExtension;
                    m_ClassGen.BaseName = xscc_Extension.BaseTypeName.Name;

                    // 위에 (**) 코드랑 같이 가려고 했는데 XmlSchemaComplexType 하고 같은 인터페이스를 사용하지 않음. 아옭 헷갈리
                    if (xscc_Extension.Particle is XmlSchemaGroupRef)
                    {
                        // 만듬.
                    }

                    else if (xscc_Extension.Particle is XmlSchemaGroupBase)
                    {
                        XmlSchemaGroupBase xgb = xscc_Extension.Particle as XmlSchemaGroupBase;
                        roopItem(xgb);
                    }
                }
                else if (xscc.Content is XmlSchemaComplexContentRestriction)
                {
                    throw new NotImplementedException();
                }
            }
        }
Beispiel #25
0
        IEnumerable <XObject> CreateProtoComplexContent(XmlSchemaComplexContent complexContent, XmlSchemaType baseType)
        {
            var content = complexContent.Content as XmlSchemaComplexContentExtension;

            if (baseType != null)
            {
                foreach (var x in CreateProtoAnyType(baseType))
                {
                    yield return(x);
                }
            }

            foreach (XmlSchemaAttribute attr in content.Attributes)
            {
                if (attr.Use == XmlSchemaUse.Required)
                {
                    var    name   = attr.QualifiedName.ToXName();
                    string retres = null;
                    if (attr.FixedValue != null)
                    {
                        throw new Exception("not implemented");
                    }
                    else if (attr.DefaultValue != null)
                    {
                        retres = attr.DefaultValue;
                    }
                    else
                    {
                        retres = CreateProtoSimpleType(attr.AttributeSchemaType);
                    }
                    yield return(new XAttribute(name, retres));
                }
            }
            if (content.Particle != null)
            {
                var particle = content.Particle;
                if ((int)particle.MinOccurs > 0)
                {
                    foreach (var retval in CreateProtoParticle(particle).Repeat((int)particle.MinOccurs))
                    {
                        yield return(retval);
                    }
                }
            }
        }
Beispiel #26
0
        public XmlSchemaComplexType CreateDataType(DataType dataType)
        {
            // create types

            XmlSchemaComplexType complexType = new XmlSchemaComplexType();

            complexType.Name = dataType.Name;
            complexType.AddSchemaDocumentation(dataType.Description);
            CogsSchema.Items.Add(complexType);

            XmlSchemaSequence itemElements = new XmlSchemaSequence();

            if (dataType.IsAbstract)
            {
                complexType.IsAbstract = true;
            }
            if (!string.IsNullOrWhiteSpace(dataType.ExtendsTypeName))
            {
                XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();
                complexType.ContentModel = complexContent;

                XmlSchemaComplexContentExtension contentExtension = new XmlSchemaComplexContentExtension();
                complexContent.Content        = contentExtension;
                contentExtension.BaseTypeName = new XmlQualifiedName(dataType.ExtendsTypeName, TargetNamespace);

                contentExtension.Particle = itemElements;
            }
            else
            {
                complexType.Particle = itemElements;
            }

            foreach (var property in dataType.Properties)
            {
                if (property.Name == "space")
                {
                    continue;//TODO
                }


                CreateElementReference(itemElements, property);
            }

            return(complexType);
        }
Beispiel #27
0
        private MemberMapping[] ImportTypeMembers(XmlSchemaComplexType type, string typeNs, CodeIdentifiers members)
        {
            if (type.AnyAttribute != null)
            {
                throw new InvalidOperationException(Res.GetString("XmlInvalidAnyAttributeUse", new object[] { type.Name, type.QualifiedName.Namespace }));
            }
            XmlSchemaObjectCollection attributes = type.Attributes;

            for (int i = 0; i < attributes.Count; i++)
            {
                object obj2 = attributes[i];
                if (obj2 is XmlSchemaAttributeGroup)
                {
                    throw new InvalidOperationException(Res.GetString("XmlSoapInvalidAttributeUse", new object[] { type.Name, type.QualifiedName.Namespace }));
                }
                if (obj2 is XmlSchemaAttribute)
                {
                    XmlSchemaAttribute attribute = (XmlSchemaAttribute)obj2;
                    if (attribute.Use != XmlSchemaUse.Prohibited)
                    {
                        throw new InvalidOperationException(Res.GetString("XmlSoapInvalidAttributeUse", new object[] { type.Name, type.QualifiedName.Namespace }));
                    }
                }
            }
            if (type.Particle != null)
            {
                this.ImportGroup(type.Particle, members, typeNs);
            }
            else if ((type.ContentModel != null) && (type.ContentModel is XmlSchemaComplexContent))
            {
                XmlSchemaComplexContent contentModel = (XmlSchemaComplexContent)type.ContentModel;
                if (contentModel.Content is XmlSchemaComplexContentExtension)
                {
                    if (((XmlSchemaComplexContentExtension)contentModel.Content).Particle != null)
                    {
                        this.ImportGroup(((XmlSchemaComplexContentExtension)contentModel.Content).Particle, members, typeNs);
                    }
                }
                else if ((contentModel.Content is XmlSchemaComplexContentRestriction) && (((XmlSchemaComplexContentRestriction)contentModel.Content).Particle != null))
                {
                    this.ImportGroup(((XmlSchemaComplexContentRestriction)contentModel.Content).Particle, members, typeNs);
                }
            }
            return((MemberMapping[])members.ToArray(typeof(MemberMapping)));
        }
 public void GetExpectedValues(XmlSchemaType si, XmlIntellisenseList list)
 {
     if (si == null)
     {
         return;
     }
     if (si is XmlSchemaSimpleType)
     {
         XmlSchemaSimpleType st = (XmlSchemaSimpleType)si;
         GetExpectedValues(st, list);
     }
     else if (si is XmlSchemaComplexType)
     {
         XmlSchemaComplexType ct = (XmlSchemaComplexType)si;
         if (ct.ContentModel is XmlSchemaComplexContent)
         {
             XmlSchemaComplexContent cc = (XmlSchemaComplexContent)ct.ContentModel;
             if (cc.Content is XmlSchemaComplexContentExtension)
             {
                 XmlSchemaComplexContentExtension ce = (XmlSchemaComplexContentExtension)cc.Content;
                 GetExpectedValues(GetTypeInfo(ce.BaseTypeName), list);
             }
             else if (cc.Content is XmlSchemaComplexContentRestriction)
             {
                 XmlSchemaComplexContentRestriction cr = (XmlSchemaComplexContentRestriction)cc.Content;
                 GetExpectedValues(GetTypeInfo(cr.BaseTypeName), list);
             }
         }
         else if (ct.ContentModel is XmlSchemaSimpleContent)
         {
             XmlSchemaSimpleContent sc = (XmlSchemaSimpleContent)ct.ContentModel;
             if (sc.Content is XmlSchemaSimpleContentExtension)
             {
                 XmlSchemaSimpleContentExtension ce = (XmlSchemaSimpleContentExtension)sc.Content;
                 GetExpectedValues(GetTypeInfo(ce.BaseTypeName), list);
             }
             else if (sc.Content is XmlSchemaSimpleContentRestriction)
             {
                 XmlSchemaSimpleContentRestriction cr = (XmlSchemaSimpleContentRestriction)sc.Content;
                 GetExpectedValues(GetTypeInfo(cr.BaseTypeName), list);
             }
         }
     }
     return;
 }
        XmlSchemaAttribute FindAttribute(XmlSchemaComplexContent complexContent, string name)
        {
            var extension = complexContent.Content as XmlSchemaComplexContentExtension;

            if (extension != null)
            {
                return(FindAttribute(extension, name));
            }

            var restriction = complexContent.Content as XmlSchemaComplexContentRestriction;

            if (restriction != null)
            {
                return(FindAttribute(restriction, name));
            }

            return(null);
        }
Beispiel #30
0
        /// <summary>
        /// Creates the schema type representing the trigger type
        /// </summary>
        /// <returns>Type definition for a trigger</returns>
        static XmlSchemaType CreateTriggerType()
        {
            XmlSchemaComplexContentExtension Extension = new XmlSchemaComplexContentExtension();

            Extension.BaseTypeName = GetQualifiedTypeName(ScriptSchemaStandardType.TriggerBody);
            Extension.Attributes.Add(CreateSchemaAttribute("Name", ScriptSchemaStandardType.QualifiedName, XmlSchemaUse.Required));
            Extension.Attributes.Add(CreateSchemaAttribute("If", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Optional));

            XmlSchemaComplexContent ContentModel = new XmlSchemaComplexContent();

            ContentModel.Content = Extension;

            XmlSchemaComplexType ComplexType = new XmlSchemaComplexType();

            ComplexType.Name         = GetTypeName(ScriptSchemaStandardType.Trigger);
            ComplexType.ContentModel = ContentModel;
            return(ComplexType);
        }