global::System.Xml.Schema.XmlSchema Read66_XmlSchema(bool isNullable, bool checkType) {
     System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null;
     bool isNull = false;
     if (isNullable) isNull = ReadNull();
     if (checkType) {
     if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id96_XmlSchema && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id95_Item)) {
     }
     else
         throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType);
     }
     if (isNull) return null;
     DecodeName = false;
     global::System.Xml.Schema.XmlSchema o;
     o = new global::System.Xml.Schema.XmlSchema();
     global::System.Xml.Schema.XmlSchemaObjectCollection a_7 = (global::System.Xml.Schema.XmlSchemaObjectCollection)o.@Includes;
     global::System.Xml.Schema.XmlSchemaObjectCollection a_8 = (global::System.Xml.Schema.XmlSchemaObjectCollection)o.@Items;
     global::System.Xml.XmlAttribute[] a_10 = null;
     int ca_10 = 0;
     bool[] paramsRead = new bool[11];
     while (Reader.MoveToNextAttribute()) {
         if (!paramsRead[1] && ((object) Reader.LocalName == (object)id97_attributeFormDefault && (object) Reader.NamespaceURI == (object)id5_Item)) {
             o.@AttributeFormDefault = Read6_XmlSchemaForm(Reader.Value);
             paramsRead[1] = true;
         }
         else if (!paramsRead[2] && ((object) Reader.LocalName == (object)id98_blockDefault && (object) Reader.NamespaceURI == (object)id5_Item)) {
             o.@BlockDefault = Read7_XmlSchemaDerivationMethod(Reader.Value);
             paramsRead[2] = true;
         }
         else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id99_finalDefault && (object) Reader.NamespaceURI == (object)id5_Item)) {
             o.@FinalDefault = Read7_XmlSchemaDerivationMethod(Reader.Value);
             paramsRead[3] = true;
         }
         else if (!paramsRead[4] && ((object) Reader.LocalName == (object)id100_elementFormDefault && (object) Reader.NamespaceURI == (object)id5_Item)) {
             o.@ElementFormDefault = Read6_XmlSchemaForm(Reader.Value);
             paramsRead[4] = true;
         }
         else if (!paramsRead[5] && ((object) Reader.LocalName == (object)id6_targetNamespace && (object) Reader.NamespaceURI == (object)id5_Item)) {
             o.@TargetNamespace = CollapseWhitespace(Reader.Value);
             paramsRead[5] = true;
         }
         else if (!paramsRead[6] && ((object) Reader.LocalName == (object)id101_version && (object) Reader.NamespaceURI == (object)id5_Item)) {
             o.@Version = CollapseWhitespace(Reader.Value);
             paramsRead[6] = true;
         }
         else if (!paramsRead[9] && ((object) Reader.LocalName == (object)id102_id && (object) Reader.NamespaceURI == (object)id5_Item)) {
             o.@Id = CollapseWhitespace(Reader.Value);
             paramsRead[9] = true;
         }
         else if (IsXmlnsAttribute(Reader.Name)) {
             if (o.@Namespaces == null) o.@Namespaces = new global::System.Xml.Serialization.XmlSerializerNamespaces();
             ((global::System.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value);
         }
         else {
             System.Xml.XmlAttribute attr = (System.Xml.XmlAttribute) Document.ReadNode(Reader);
             ParseWsdlArrayType(attr);
             a_10 = (global::System.Xml.XmlAttribute[])EnsureArrayIndex(a_10, ca_10, typeof(global::System.Xml.XmlAttribute)); a_10[ca_10++] = attr;
         }
     }
     o.@UnhandledAttributes = (global::System.Xml.XmlAttribute[])ShrinkArray(a_10, ca_10, typeof(global::System.Xml.XmlAttribute), true);
     Reader.MoveToElement();
     if (Reader.IsEmptyElement) {
         Reader.Skip();
         o.@UnhandledAttributes = (global::System.Xml.XmlAttribute[])ShrinkArray(a_10, ca_10, typeof(global::System.Xml.XmlAttribute), true);
         return o;
     }
     Reader.ReadStartElement();
     Reader.MoveToContent();
     int whileIterations41 = 0;
     int readerCount41 = ReaderCount;
     while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) {
         if (Reader.NodeType == System.Xml.XmlNodeType.Element) {
             if (((object) Reader.LocalName == (object)id103_include && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_7) == null) Reader.Skip(); else a_7.Add(Read12_XmlSchemaInclude(false, true));
             }
             else if (((object) Reader.LocalName == (object)id8_import && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_7) == null) Reader.Skip(); else a_7.Add(Read13_XmlSchemaImport(false, true));
             }
             else if (((object) Reader.LocalName == (object)id104_redefine && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_7) == null) Reader.Skip(); else a_7.Add(Read64_XmlSchemaRedefine(false, true));
             }
             else if (((object) Reader.LocalName == (object)id105_simpleType && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_8) == null) Reader.Skip(); else a_8.Add(Read34_XmlSchemaSimpleType(false, true));
             }
             else if (((object) Reader.LocalName == (object)id106_complexType && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_8) == null) Reader.Skip(); else a_8.Add(Read62_XmlSchemaComplexType(false, true));
             }
             else if (((object) Reader.LocalName == (object)id107_annotation && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_8) == null) Reader.Skip(); else a_8.Add(Read11_XmlSchemaAnnotation(false, true));
             }
             else if (((object) Reader.LocalName == (object)id108_notation && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_8) == null) Reader.Skip(); else a_8.Add(Read65_XmlSchemaNotation(false, true));
             }
             else if (((object) Reader.LocalName == (object)id59_group && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_8) == null) Reader.Skip(); else a_8.Add(Read63_XmlSchemaGroup(false, true));
             }
             else if (((object) Reader.LocalName == (object)id92_element && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_8) == null) Reader.Skip(); else a_8.Add(Read52_XmlSchemaElement(false, true));
             }
             else if (((object) Reader.LocalName == (object)id109_attribute && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_8) == null) Reader.Skip(); else a_8.Add(Read36_XmlSchemaAttribute(false, true));
             }
             else if (((object) Reader.LocalName == (object)id110_attributeGroup && (object) Reader.NamespaceURI == (object)id95_Item)) {
                 if ((object)(a_8) == null) Reader.Skip(); else a_8.Add(Read40_XmlSchemaAttributeGroup(false, true));
             }
             else {
                 UnknownNode((object)o, @"http://www.w3.org/2001/XMLSchema:include, http://www.w3.org/2001/XMLSchema:import, http://www.w3.org/2001/XMLSchema:redefine, http://www.w3.org/2001/XMLSchema:simpleType, http://www.w3.org/2001/XMLSchema:complexType, http://www.w3.org/2001/XMLSchema:annotation, http://www.w3.org/2001/XMLSchema:notation, http://www.w3.org/2001/XMLSchema:group, http://www.w3.org/2001/XMLSchema:element, http://www.w3.org/2001/XMLSchema:attribute, http://www.w3.org/2001/XMLSchema:attributeGroup");
             }
         }
         else {
             UnknownNode((object)o, @"http://www.w3.org/2001/XMLSchema:include, http://www.w3.org/2001/XMLSchema:import, http://www.w3.org/2001/XMLSchema:redefine, http://www.w3.org/2001/XMLSchema:simpleType, http://www.w3.org/2001/XMLSchema:complexType, http://www.w3.org/2001/XMLSchema:annotation, http://www.w3.org/2001/XMLSchema:notation, http://www.w3.org/2001/XMLSchema:group, http://www.w3.org/2001/XMLSchema:element, http://www.w3.org/2001/XMLSchema:attribute, http://www.w3.org/2001/XMLSchema:attributeGroup");
         }
         Reader.MoveToContent();
         CheckReaderCount(ref whileIterations41, ref readerCount41);
     }
     o.@UnhandledAttributes = (global::System.Xml.XmlAttribute[])ShrinkArray(a_10, ca_10, typeof(global::System.Xml.XmlAttribute), true);
     ReadEndElement();
     return o;
 }
Example #2
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                DataSet3 ds = new DataSet3();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "DataTable1DataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }