コード例 #1
0
        /// <summary>
        /// Create a description of arguments used by a constructor.
        /// </summary>
        /// <param name="constructorSchema">A description of the constructor.</param>
        /// <param name="xmlNode">The XML Schema extensions that describe the arguments.</param>
        public ArgumentSchema(ConstructorSchema constructorSchema, XmlNode xmlNode)
        {
            // Initialize the object.
            this.constructorSchema = constructorSchema;

            // Extract the argument type from the XML extension.
            XmlAttribute typeAttribute = xmlNode.Attributes[QualifiedName.VariableType.Name, QualifiedName.VariableType.Namespace];

            this.type = typeAttribute.Value;

            // Extract the value of the argument from the XML Extension.
            XmlAttribute nameAttribute = xmlNode.Attributes[QualifiedName.VariableName.Name, QualifiedName.VariableName.Namespace];

            this.name = nameAttribute.Value;
        }
コード例 #2
0
        /// <summary>
        /// The description of a class.
        /// </summary>
        /// <param name="presentationSchema">The PresentationSchema to which this class belongs.</param>
        /// <param name="xmlSchemaComplexType">The XML Schema description of the class.</param>
        public ClassSchema(PresentationSchema presentationSchema, XmlSchemaComplexType xmlSchemaComplexType)
        {
            // Initialize the object.
            this.name = xmlSchemaComplexType.QualifiedName.Name;
            this.presentationSchema = presentationSchema;
            this.propertyList       = new List <PropertySchema>();
            this.targetNamespace    = xmlSchemaComplexType.QualifiedName.Namespace;
            this.type = xmlSchemaComplexType.QualifiedName.ToString();

            // This will create the list of properties of this type.
            if (xmlSchemaComplexType.Particle is XmlSchemaSequence)
            {
                XmlSchemaSequence xmlSchemaSequence = xmlSchemaComplexType.Particle as XmlSchemaSequence;
                foreach (XmlSchemaObject item in xmlSchemaSequence.Items)
                {
                    if (item is XmlSchemaElement)
                    {
                        this.propertyList.Add(new PropertySchema(this, item as XmlSchemaElement));
                    }
                }
            }

            // This will create and initialize a description of the constructor for the class from the XML Schema extensions.
            this.constructorSchema = new ConstructorSchema(this);
            if (xmlSchemaComplexType.Annotation != null)
            {
                foreach (XmlSchemaObject xmlSchemaObject in xmlSchemaComplexType.Annotation.Items)
                {
                    if (xmlSchemaObject is XmlSchemaAppInfo)
                    {
                        XmlSchemaAppInfo xmlSchemaAppInfo = xmlSchemaObject as XmlSchemaAppInfo;
                        foreach (XmlNode constructorNode in xmlSchemaAppInfo.Markup)
                        {
                            if (QualifiedName.Constructor == new XmlQualifiedName(constructorNode.LocalName, constructorNode.NamespaceURI))
                            {
                                this.constructorSchema = new ConstructorSchema(this, constructorNode);
                            }
                        }
                    }
                }
            }
        }