Example #1
0
        /// <summary>
        ///Чтение дочерних элементов класса SeSchemaItem и запись их в класс SeSchemaItem
        /// </summary>
        /// <param name="childElement">Считанный дочерний элемент считанного XSD</param>
        public void ReadXSD(XmlSchemaObject childElement)
        {
            List <SeSchemaItem> schemaTypeInCT;
            List <SeSchemaItem> schemaTypeInChoice;
            XmlSchemaElement    schemaElement = null;
            XmlSchemaSequence   seq           = null;

            if (childElement is XmlSchemaChoice)
            {
                SchemaItemsChildren.Add(new SeSchemaItem("CHOICE", "", "", this, schemaTypeInChoice = new List <SeSchemaItem>(), null));
                var choice = (XmlSchemaChoice)childElement;
                if (choice.Items[0] is XmlSchemaSequence)
                {
                    seq = (XmlSchemaSequence)choice.Items[0];
                    foreach (XmlSchemaElement childElement2 in seq.Items)
                    {
                        ReadXSD(childElement2);
                    }
                }
                if (seq == null)
                {
                    foreach (XmlSchemaObject childElementChild in choice.Items)
                    {
                        if (childElementChild is XmlSchemaElement)
                        {
                            schemaElement = childElementChild as XmlSchemaElement;
                            SeProperties seProp2 = new SeProperties(schemaElement);
                            schemaTypeInChoice.Add(new SeSchemaItem(schemaElement.Name, GetAnnotation(childElementChild), schemaElement.SchemaTypeName.Name, this, schemaTypeInCT = new List <SeSchemaItem>(), seProp2));
                        }
                        else
                        {
                            seq = (XmlSchemaSequence)childElementChild;
                            foreach (XmlSchemaElement childElementSeq in seq.Items)
                            {
                                ReadXSD(childElementSeq);
                            }
                        }
                    }
                }
            }
            else if (childElement is XmlSchemaElement)
            {
                schemaElement = childElement as XmlSchemaElement;
                SeProperties seProp = new SeProperties(schemaElement);
                //<xsd:element name="..._ITEM">
                SeSchemaItem schemaItem = new SeSchemaItem(schemaElement.Name, GetAnnotation(schemaElement), schemaElement.SchemaTypeName.Name, this, schemaTypeInCT = new List <SeSchemaItem>(), seProp);

                if (schemaElement.ElementType is XmlSchemaSimpleType)
                {
                    List <SeSchemaItem> schemaTypeInST = new List <SeSchemaItem>();
                    SeSchemaItem        ssi            = new SeSchemaItem(schemaElement.Name, GetAnnotation(schemaElement), GetSimpleType(schemaTypeInST, schemaElement), this, schemaTypeInST, seProp);
                    SchemaItemsChildren.Add(ssi);
                }
                else
                {
                    SchemaItemsChildren.Add(schemaItem);
                    schemaItem.ReadXSDParticle(schemaElement);
                }
            }
        }
Example #2
0
 public SeSchemaItem()
 {
     Name                = "Untitled";
     Description         = null;
     Type                = "string";
     SchemaItemsChildren = new List <SeSchemaItem>();
     Properties          = new SeProperties();
 }
Example #3
0
 private SeSchemaItem(string Name, string Description, string Type, object Parent, List <SeSchemaItem> SchemaItemsChildren, SeProperties Properties)
 {
     this.Name                = Name;
     this.Description         = Description;
     this.Type                = Type;
     this.Parent              = Parent;
     this.SchemaItemsChildren = SchemaItemsChildren;
     this.Properties          = Properties;
 }