예제 #1
0
        private static void UpdatePropertyFormatInfo(XmlSchemaAnnotated schemaItem, SampleProperty sampleProperty)
        {
            XmlAttribute[] unhandledAttributes  = schemaItem.UnhandledAttributes;
            string         blendAttributeValue1 = SampleDataXsdParser.GetBlendAttributeValue(unhandledAttributes, SampleProperty.FormatAttribute);
            string         blendAttributeValue2 = SampleDataXsdParser.GetBlendAttributeValue(unhandledAttributes, SampleProperty.FormatParametersAttribute);

            sampleProperty.ChangeFormat(blendAttributeValue1, blendAttributeValue2);
        }
예제 #2
0
        private void PopulateSampleCompositeType(SampleCompositeType compositeType, XmlSchemaComplexType xmlComplexType)
        {
            XmlSchemaSequence xmlSchemaSequence = xmlComplexType.Particle as XmlSchemaSequence;

            if (xmlSchemaSequence == null && xmlComplexType.Particle != null)
            {
                throw new InvalidDataException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, ExceptionStringTable.InvalidTypeFormat, new object[2]
                {
                    (object)this.xsdFileName,
                    (object)xmlComplexType.Name
                }));
            }
            if (xmlSchemaSequence != null)
            {
                foreach (XmlSchemaObject xmlSchemaObject in xmlSchemaSequence.Items)
                {
                    XmlSchemaElement xmlSchemaElement = xmlSchemaObject as XmlSchemaElement;
                    if (xmlSchemaElement != null)
                    {
                        SampleType     sampleType     = this.GetSampleType(xmlSchemaElement.SchemaTypeName);
                        SampleProperty sampleProperty = compositeType.AddProperty(xmlSchemaElement.Name, sampleType);
                        SampleDataXsdParser.UpdatePropertyFormatInfo((XmlSchemaAnnotated)xmlSchemaElement, sampleProperty);
                        if (sampleProperty.Name != xmlSchemaElement.Name)
                        {
                            throw new InvalidDataException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, ExceptionStringTable.InvalidNodeUsage, new object[2]
                            {
                                (object)this.xsdFileName,
                                (object)xmlSchemaElement.Name
                            }));
                        }
                    }
                }
            }
            foreach (XmlSchemaAttribute xmlSchemaAttribute in xmlComplexType.Attributes)
            {
                SampleBasicType sampleBasicType = this.GetSampleType(xmlSchemaAttribute.SchemaTypeName) as SampleBasicType;
                SampleProperty  sampleProperty  = compositeType.AddProperty(xmlSchemaAttribute.Name, (SampleType)sampleBasicType);
                SampleDataXsdParser.UpdatePropertyFormatInfo((XmlSchemaAnnotated)xmlSchemaAttribute, sampleProperty);
                if (sampleProperty.Name != xmlSchemaAttribute.Name)
                {
                    throw new InvalidDataException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, ExceptionStringTable.InvalidNodeUsage, new object[2]
                    {
                        (object)this.xsdFileName,
                        (object)xmlSchemaAttribute.Name
                    }));
                }
            }
        }