示例#1
0
        internal XmlSchemaElement CreateXsdElement()
        {
            XmlSchemaElement el = new XmlSchemaElement();

            SetLineInfo(el);
            el.Name = Name;

            XmlSchemaComplexType ct = new XmlSchemaComplexType();

            el.SchemaType = ct;
            if (Attributes != null)
            {
                SetLineInfo(ct);
                foreach (DTDAttributeDefinition a in
                         Attributes.Definitions)
                {
                    ct.Attributes.Add(a.CreateXsdAttribute());
                }
            }
            if (IsEmpty)
            {
                ;                 // nothing to do
            }
            else if (IsAny)
            {
                XmlSchemaAny any = new XmlSchemaAny();
                any.MinOccurs       = 0;
                any.MaxOccursString = "unbounded";
                ct.Particle         = any;
            }
            else
            {
                if (IsMixedContent)
                {
                    ct.IsMixed = true;
                }
                ct.Particle = ContentModel.CreateXsdParticle();
            }

            /*
             * if (IsEmpty) {
             *      el.SchemaType = new XmlSchemaComplexType ();
             *      SetLineInfo (el.SchemaType);
             * }
             * else if (IsAny)
             *      el.SchemaTypeName = new XmlQualifiedName (
             *              "anyType", XmlSchema.Namespace);
             * else {
             *      XmlSchemaComplexType ct = new XmlSchemaComplexType ();
             *      SetLineInfo (ct);
             *      if (Attributes != null)
             *              foreach (DTDAttributeDefinition a in
             *                      Attributes.Definitions)
             *                      ct.Attributes.Add (a.CreateXsdAttribute ());
             *      if (IsMixedContent)
             *              ct.IsMixed = true;
             *      ct.Particle = ContentModel.CreateXsdParticle ();
             *      el.SchemaType = ct;
             * }
             */
            return(el);
        }