Ejemplo n.º 1
0
 public static XmlSchemaComplexType GetTypedTableSchema(XmlSchemaSet xs)
 {
     XmlSchemaComplexType type = new XmlSchemaComplexType();
     XmlSchemaSequence sequence = new XmlSchemaSequence();
     StreetsHousesFlatsDS sds = new StreetsHousesFlatsDS();
     XmlSchemaAny any = new XmlSchemaAny();
     any.set_Namespace("http://www.w3.org/2001/XMLSchema");
     any.set_MinOccurs(0M);
     any.set_MaxOccurs(79228162514264337593543950335M);
     any.set_ProcessContents(XmlSchemaContentProcessing.Lax);
     sequence.Items.Add(any);
     XmlSchemaAny any2 = new XmlSchemaAny();
     any2.set_Namespace("urn:schemas-microsoft-com:xml-diffgram-v1");
     any2.set_MinOccurs(1M);
     any2.set_ProcessContents(XmlSchemaContentProcessing.Lax);
     sequence.Items.Add(any2);
     XmlSchemaAttribute attribute = new XmlSchemaAttribute();
     attribute.set_Name("namespace");
     attribute.set_FixedValue(sds.get_Namespace());
     type.Attributes.Add(attribute);
     XmlSchemaAttribute attribute2 = new XmlSchemaAttribute();
     attribute2.set_Name("tableTypeName");
     attribute2.set_FixedValue("FlatsDataTable");
     type.Attributes.Add(attribute2);
     type.set_Particle(sequence);
     XmlSchema schemaSerializable = sds.GetSchemaSerializable();
     if (xs.Contains(schemaSerializable.get_TargetNamespace()))
     {
         System.IO.MemoryStream stream = new System.IO.MemoryStream();
         System.IO.MemoryStream stream2 = new System.IO.MemoryStream();
         try
         {
             XmlSchema schema2 = null;
             schemaSerializable.Write(stream);
             System.Collections.IEnumerator enumerator = xs.Schemas(schemaSerializable.get_TargetNamespace()).GetEnumerator();
             while (enumerator.MoveNext())
             {
                 schema2 = (XmlSchema) enumerator.get_Current();
                 stream2.SetLength((long) 0L);
                 schema2.Write(stream2);
                 if (stream.get_Length() == stream2.get_Length())
                 {
                     stream.set_Position((long) 0L);
                     stream2.set_Position((long) 0L);
                     while ((stream.get_Position() != stream.get_Length()) && (stream.ReadByte() == stream2.ReadByte()))
                     {
                     }
                     if (stream.get_Position() == stream.get_Length())
                     {
                         return type;
                     }
                 }
             }
         }
         finally
         {
             if (stream != null)
             {
                 stream.Close();
             }
             if (stream2 != null)
             {
                 stream2.Close();
             }
         }
     }
     xs.Add(schemaSerializable);
     return type;
 }
Ejemplo n.º 2
0
 public static XmlSchemaComplexType GetTypedDataSetSchema(XmlSchemaSet xs)
 {
     StreetsHousesFlatsDS sds = new StreetsHousesFlatsDS();
     XmlSchemaComplexType type = new XmlSchemaComplexType();
     XmlSchemaSequence sequence = new XmlSchemaSequence();
     XmlSchemaAny any = new XmlSchemaAny();
     any.set_Namespace(sds.get_Namespace());
     sequence.Items.Add(any);
     type.set_Particle(sequence);
     XmlSchema schemaSerializable = sds.GetSchemaSerializable();
     if (xs.Contains(schemaSerializable.get_TargetNamespace()))
     {
         System.IO.MemoryStream stream = new System.IO.MemoryStream();
         System.IO.MemoryStream stream2 = new System.IO.MemoryStream();
         try
         {
             XmlSchema schema2 = null;
             schemaSerializable.Write(stream);
             System.Collections.IEnumerator enumerator = xs.Schemas(schemaSerializable.get_TargetNamespace()).GetEnumerator();
             while (enumerator.MoveNext())
             {
                 schema2 = (XmlSchema) enumerator.get_Current();
                 stream2.SetLength((long) 0L);
                 schema2.Write(stream2);
                 if (stream.get_Length() == stream2.get_Length())
                 {
                     stream.set_Position((long) 0L);
                     stream2.set_Position((long) 0L);
                     while ((stream.get_Position() != stream.get_Length()) && (stream.ReadByte() == stream2.ReadByte()))
                     {
                     }
                     if (stream.get_Position() == stream.get_Length())
                     {
                         return type;
                     }
                 }
             }
         }
         finally
         {
             if (stream != null)
             {
                 stream.Close();
             }
             if (stream2 != null)
             {
                 stream2.Close();
             }
         }
     }
     xs.Add(schemaSerializable);
     return type;
 }