private void Write46_XmlSchemaElement(XmlSchemaElement o)
 {
     if (o != null)
     {
         o.GetType();
         this.WriteStartElement("element");
         this.WriteAttribute("id", "", o.Id);
         this.WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
         this.WriteAttribute("maxOccurs", "", (o.MaxOccurs == 79228162514264337593543950335M) ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
         if (o.IsAbstract)
         {
             this.WriteAttribute("abstract", "", XmlConvert.ToString(o.IsAbstract));
         }
         this.WriteAttribute("block", "", this.Write11_XmlSchemaDerivationMethod(o.BlockResolved));
         this.WriteAttribute("default", "", o.DefaultValue);
         this.WriteAttribute("final", "", this.Write11_XmlSchemaDerivationMethod(o.FinalResolved));
         this.WriteAttribute("fixed", "", o.FixedValue);
         if ((o.Parent != null) && !(o.Parent is XmlSchema))
         {
             if (((o.QualifiedName != null) && !o.QualifiedName.IsEmpty) && ((o.QualifiedName.Namespace != null) && (o.QualifiedName.Namespace.Length != 0)))
             {
                 this.WriteAttribute("form", "", "qualified");
             }
             else
             {
                 this.WriteAttribute("form", "", "unqualified");
             }
         }
         if ((o.Name != null) && (o.Name.Length != 0))
         {
             this.WriteAttribute("name", "", o.Name);
         }
         if (o.IsNillable)
         {
             this.WriteAttribute("nillable", "", XmlConvert.ToString(o.IsNillable));
         }
         if (!o.SubstitutionGroup.IsEmpty)
         {
             this.WriteAttribute("substitutionGroup", "", o.SubstitutionGroup);
         }
         if (!o.RefName.IsEmpty)
         {
             this.WriteAttribute("ref", "", o.RefName);
         }
         else if (!o.SchemaTypeName.IsEmpty)
         {
             this.WriteAttribute("type", "", o.SchemaTypeName);
         }
         this.WriteAttributes(o.UnhandledAttributes, o);
         this.Write5_XmlSchemaAnnotation(o.Annotation);
         if (o.SchemaType is XmlSchemaComplexType)
         {
             this.Write35_XmlSchemaComplexType((XmlSchemaComplexType) o.SchemaType);
         }
         else if (o.SchemaType is XmlSchemaSimpleType)
         {
             this.Write9_XmlSchemaSimpleType((XmlSchemaSimpleType) o.SchemaType);
         }
         this.WriteSortedItems(o.Constraints);
         this.WriteEndElement();
     }
 }
 void Write46_XmlSchemaElement(XmlSchemaElement o) {
     if ((object)o == null) return;
     System.Type t = o.GetType();
     WriteStartElement("element");
     WriteAttribute(@"id", @"", o.Id);
     WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
     WriteAttribute("maxOccurs", "", o.MaxOccurs == decimal.MaxValue ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
     if (((System.Boolean)o.@IsAbstract) != false) {
         WriteAttribute(@"abstract", @"", XmlConvert.ToString((System.Boolean)((System.Boolean)o.@IsAbstract)));
     }
     WriteAttribute(@"block", @"", Write11_XmlSchemaDerivationMethod(o.BlockResolved));
     WriteAttribute(@"default", @"", o.DefaultValue);
     WriteAttribute(@"final", @"", Write11_XmlSchemaDerivationMethod(o.FinalResolved));
     WriteAttribute(@"fixed", @"", o.FixedValue);
     if (o.Parent != null && !(o.Parent is XmlSchema)) {
         if (o.QualifiedName != null && !o.QualifiedName.IsEmpty && o.QualifiedName.Namespace != null && o.QualifiedName.Namespace.Length != 0) {
             WriteAttribute(@"form", @"", "qualified");
         }
         else {
             WriteAttribute(@"form", @"", "unqualified");
         }
     }
     if (o.Name != null && o.Name.Length != 0) {
         WriteAttribute(@"name", @"", o.Name);
     }
     if (o.IsNillable) {
         WriteAttribute(@"nillable", @"", XmlConvert.ToString(o.IsNillable));
     }
     if (!o.SubstitutionGroup.IsEmpty) {
         WriteAttribute("substitutionGroup", "", o.SubstitutionGroup);
     }
     if (!o.RefName.IsEmpty) {
         WriteAttribute("ref", "", o.RefName);
     }
     else if (!o.SchemaTypeName.IsEmpty) {
         WriteAttribute("type", "", o.SchemaTypeName);
     }
     
     WriteAttributes((XmlAttribute[])o.@UnhandledAttributes, o);
     Write5_XmlSchemaAnnotation(o.Annotation);
     if (o.SchemaType is XmlSchemaComplexType) {
         Write35_XmlSchemaComplexType((XmlSchemaComplexType)o.SchemaType);
     }
     else if (o.SchemaType is XmlSchemaSimpleType) {
         Write9_XmlSchemaSimpleType((XmlSchemaSimpleType)o.SchemaType);
     }
     WriteSortedItems(o.Constraints);
     WriteEndElement();
 }
 private void Write52_XmlSchemaElement(string n, string ns, XmlSchemaElement o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(XmlSchemaElement)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.EscapeName = false;
         base.WriteStartElement(n, ns, o, false, o.Namespaces);
         if (needType)
         {
             base.WriteXsiType("XmlSchemaElement", "http://www.w3.org/2001/XMLSchema");
         }
         base.WriteAttribute("id", "", o.Id);
         XmlAttribute[] unhandledAttributes = o.UnhandledAttributes;
         if (unhandledAttributes != null)
         {
             for (int i = 0; i < unhandledAttributes.Length; i++)
             {
                 XmlAttribute node = unhandledAttributes[i];
                 base.WriteXmlAttribute(node, o);
             }
         }
         base.WriteAttribute("minOccurs", "", o.MinOccursString);
         base.WriteAttribute("maxOccurs", "", o.MaxOccursString);
         if (o.IsAbstract)
         {
             base.WriteAttribute("abstract", "", XmlConvert.ToString(o.IsAbstract));
         }
         if (o.Block != XmlSchemaDerivationMethod.None)
         {
             base.WriteAttribute("block", "", this.Write7_XmlSchemaDerivationMethod(o.Block));
         }
         base.WriteAttribute("default", "", o.DefaultValue);
         if (o.Final != XmlSchemaDerivationMethod.None)
         {
             base.WriteAttribute("final", "", this.Write7_XmlSchemaDerivationMethod(o.Final));
         }
         base.WriteAttribute("fixed", "", o.FixedValue);
         if (o.Form != XmlSchemaForm.None)
         {
             base.WriteAttribute("form", "", this.Write6_XmlSchemaForm(o.Form));
         }
         if ((o.Name != null) && (o.Name.Length != 0))
         {
             base.WriteAttribute("name", "", o.Name);
         }
         if (o.IsNillable)
         {
             base.WriteAttribute("nillable", "", XmlConvert.ToString(o.IsNillable));
         }
         base.WriteAttribute("ref", "", base.FromXmlQualifiedName(o.RefName));
         base.WriteAttribute("substitutionGroup", "", base.FromXmlQualifiedName(o.SubstitutionGroup));
         base.WriteAttribute("type", "", base.FromXmlQualifiedName(o.SchemaTypeName));
         this.Write11_XmlSchemaAnnotation("annotation", "http://www.w3.org/2001/XMLSchema", o.Annotation, false, false);
         if (o.SchemaType is XmlSchemaComplexType)
         {
             this.Write62_XmlSchemaComplexType("complexType", "http://www.w3.org/2001/XMLSchema", (XmlSchemaComplexType) o.SchemaType, false, false);
         }
         else if (o.SchemaType is XmlSchemaSimpleType)
         {
             this.Write34_XmlSchemaSimpleType("simpleType", "http://www.w3.org/2001/XMLSchema", (XmlSchemaSimpleType) o.SchemaType, false, false);
         }
         else if (o.SchemaType != null)
         {
             throw base.CreateUnknownTypeException(o.SchemaType);
         }
         XmlSchemaObjectCollection constraints = o.Constraints;
         if (constraints != null)
         {
             for (int j = 0; j < constraints.Count; j++)
             {
                 XmlSchemaObject obj2 = constraints[j];
                 if (obj2 is XmlSchemaKeyref)
                 {
                     this.Write51_XmlSchemaKeyref("keyref", "http://www.w3.org/2001/XMLSchema", (XmlSchemaKeyref) obj2, false, false);
                 }
                 else if (obj2 is XmlSchemaUnique)
                 {
                     this.Write50_XmlSchemaUnique("unique", "http://www.w3.org/2001/XMLSchema", (XmlSchemaUnique) obj2, false, false);
                 }
                 else if (obj2 is XmlSchemaKey)
                 {
                     this.Write49_XmlSchemaKey("key", "http://www.w3.org/2001/XMLSchema", (XmlSchemaKey) obj2, false, false);
                 }
                 else if (obj2 != null)
                 {
                     throw base.CreateUnknownTypeException(obj2);
                 }
             }
         }
         base.WriteEndElement(o);
     }
 }