private static void GenerateComplexTypeForMa(GeneratorContext context, XmlSchema schema, IMa ma)
        {
            var maType = new XmlSchemaComplexType();

            maType.Name = ma.Name + "Type";

            var sequence = new XmlSchemaSequence();

            foreach (IAsma asma in ma.Asmas)
            {
                var rasmaElement = new XmlSchemaElement();
                rasmaElement.Name           = NDR.GetXsdElementNameFromAsma(asma);
                rasmaElement.SchemaTypeName = new XmlQualifiedName(context.NamespacePrefix + ":" +
                                                                   NDR.TrimElementName(asma.AssociatedBieAggregator.Name));
                // R 90F9: cardinality of elements within the ABIE
                rasmaElement.MinOccursString = AdjustBound(asma.LowerBound);
                rasmaElement.MaxOccursString = AdjustBound(asma.UpperBound);
                //add to the sequence
                sequence.Items.Add(rasmaElement);
            }
            //set the sequence as particle of the ma complex type
            maType.Particle = sequence;
            //add the maType to the schema
            schema.Items.Add(maType);
        }
        private static XmlSchemaComplexType GenerateComplexTypeForMa(GeneratorContext context, XmlSchema schema, IMa ma, string abiePrefix)
        {
            var maType = new XmlSchemaComplexType();

            maType.Name = ma.Name + "Type";

            var sequence = new XmlSchemaSequence();

            foreach (IAsma asma in ma.Asmas.OrderBy(a => a.Name))
            {
                XmlSchemaElement elementAsma = null;

                // Take care of ASMAS aggregating ABIEs
                if (asma.AssociatedBieAggregator.IsAbie)
                {
                    elementAsma = new XmlSchemaElement
                    {
                        Name           = NDR.GetXsdElementNameFromAsma(asma),
                        SchemaTypeName =
                            new XmlQualifiedName(NSPREFIX_BIE + ":" +
                                                 asma.AssociatedBieAggregator.Name +
                                                 "Type")
                    };
                }
                else if (asma.AssociatedBieAggregator.IsMa)
                {
                    elementAsma = new XmlSchemaElement
                    {
                        Name           = NDR.GetXsdElementNameFromAsma(asma),
                        SchemaTypeName =
                            new XmlQualifiedName(context.NamespacePrefix + ":" +
                                                 asma.AssociatedBieAggregator.Name +
                                                 "Type")
                    };
                }

                var refAsma = new XmlSchemaElement
                {
                    RefName =
                        new XmlQualifiedName(context.NamespacePrefix + ":" +
                                             NDR.GetXsdElementNameFromAsma(asma))
                };

                // every shared ASCC may only appear once in the XSD file
                if (!globalAsmas.Contains(elementAsma.Name))
                {
                    // R 9241: for ASBIEs with AggregationKind = shared a global element must be declared.
                    schema.Items.Add(elementAsma);
                    globalAsmas.Add(elementAsma.Name);
                }

                sequence.Items.Add(refAsma);
            }
            maType.Particle = sequence;
            if (context.Annotate)
            {
                maType.Annotation = GetMaAnnotation(ma);
            }

            return(maType);
        }