* support-test-*.cs: Rename from test-*-p2.cs.
[mono.git] / mcs / class / System.XML / System.Xml.Schema / XmlSchemaSerializer.cs
1 using System;\r
2 using System.Xml;\r
3 using System.Xml.Schema;\r
4 using System.Xml.Serialization;\r
5 using System.Text;\r
6 using System.Collections;\r
7 using System.Globalization;\r
8 \r
9 namespace System.Xml.Schema\r
10 {\r
11 \r
12         internal class XmlSchemaSerializationWriter : XmlSerializationWriter\r
13         {\r
14                 const string xmlNamespace = "http://www.w3.org/2000/xmlns/";\r
15                 public void WriteRoot_XmlSchema (object o)\r
16                 {\r
17                         WriteStartDocument ();\r
18                         System.Xml.Schema.XmlSchema ob = (System.Xml.Schema.XmlSchema) o;\r
19                         TopLevelElement ();\r
20                         WriteObject_XmlSchema (ob, "schema", "http://www.w3.org/2001/XMLSchema", true, false, true);\r
21                 }\r
22 \r
23                 void WriteObject_XmlSchema (System.Xml.Schema.XmlSchema ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
24                 {\r
25                         if (ob == null)\r
26                         {\r
27                                 if (isNullable)\r
28                                         WriteNullTagLiteral(element, namesp);\r
29                                 return;\r
30                         }\r
31 \r
32                         System.Type type = ob.GetType ();\r
33                         if (type == typeof(System.Xml.Schema.XmlSchema))\r
34                                 ;\r
35                         else {\r
36                                 throw CreateUnknownTypeException (ob);\r
37                         }\r
38 \r
39                         if (writeWrappingElem) {\r
40                                 WriteStartElement (element, namesp, ob);\r
41                         }\r
42 \r
43                         if (needType) WriteXsiType("XmlSchema", "http://www.w3.org/2001/XMLSchema");\r
44 \r
45                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
46 \r
47                         ICollection o0 = ob.@UnhandledAttributes;\r
48                         if (o0 != null) {\r
49                                 foreach (XmlAttribute o1 in o0)\r
50                                         if (o1.NamespaceURI != xmlNamespace)\r
51                                                 WriteXmlAttribute (o1, ob);\r
52                         }\r
53 \r
54                         if (ob.@AttributeFormDefault != ((System.Xml.Schema.XmlSchemaForm) System.Xml.Schema.XmlSchemaForm.None)) {\r
55                                 WriteAttribute ("attributeFormDefault", "", GetEnumValue_XmlSchemaForm (ob.@AttributeFormDefault));\r
56                         }\r
57                         if (ob.@BlockDefault != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {\r
58                                 WriteAttribute ("blockDefault", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@BlockDefault));\r
59                         }\r
60                         if (ob.@FinalDefault != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {\r
61                                 WriteAttribute ("finalDefault", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@FinalDefault));\r
62                         }\r
63                         if (ob.@ElementFormDefault != ((System.Xml.Schema.XmlSchemaForm) System.Xml.Schema.XmlSchemaForm.None)) {\r
64                                 WriteAttribute ("elementFormDefault", "", GetEnumValue_XmlSchemaForm (ob.@ElementFormDefault));\r
65                         }\r
66                         WriteAttribute ("targetNamespace", "", ob.@TargetNamespace);\r
67                         WriteAttribute ("version", "", ob.@Version);\r
68                         WriteAttribute ("id", "", ob.@Id);\r
69 \r
70                         if (ob.@Includes != null) {\r
71                                 for (int n2 = 0; n2 < ob.@Includes.Count; n2++) {\r
72                                         if (ob.@Includes[n2] == null) { }\r
73                                         else if (ob.@Includes[n2].GetType() == typeof(System.Xml.Schema.XmlSchemaInclude)) {\r
74                                                 WriteObject_XmlSchemaInclude (((System.Xml.Schema.XmlSchemaInclude) ob.@Includes[n2]), "include", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
75                                         }\r
76                                         else if (ob.@Includes[n2].GetType() == typeof(System.Xml.Schema.XmlSchemaImport)) {\r
77                                                 WriteObject_XmlSchemaImport (((System.Xml.Schema.XmlSchemaImport) ob.@Includes[n2]), "import", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
78                                         }\r
79                                         else if (ob.@Includes[n2].GetType() == typeof(System.Xml.Schema.XmlSchemaRedefine)) {\r
80                                                 WriteObject_XmlSchemaRedefine (((System.Xml.Schema.XmlSchemaRedefine) ob.@Includes[n2]), "redefine", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
81                                         }\r
82                                         else throw CreateUnknownTypeException (ob.@Includes[n2]);\r
83                                 }\r
84                         }\r
85                         if (ob.@Items != null) {\r
86                                 for (int n3 = 0; n3 < ob.@Items.Count; n3++) {\r
87                                         if (ob.@Items[n3] == null) { }\r
88                                         else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaElement)) {\r
89                                                 WriteObject_XmlSchemaElement (((System.Xml.Schema.XmlSchemaElement) ob.@Items[n3]), "element", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
90                                         }\r
91                                         else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaSimpleType)) {\r
92                                                 WriteObject_XmlSchemaSimpleType (((System.Xml.Schema.XmlSchemaSimpleType) ob.@Items[n3]), "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
93                                         }\r
94                                         else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {\r
95                                                 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Items[n3]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
96                                         }\r
97                                         else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaAnnotation)) {\r
98                                                 WriteObject_XmlSchemaAnnotation (((System.Xml.Schema.XmlSchemaAnnotation) ob.@Items[n3]), "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
99                                         }\r
100                                         else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroup)) {\r
101                                                 WriteObject_XmlSchemaAttributeGroup (((System.Xml.Schema.XmlSchemaAttributeGroup) ob.@Items[n3]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
102                                         }\r
103                                         else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaGroup)) {\r
104                                                 WriteObject_XmlSchemaGroup (((System.Xml.Schema.XmlSchemaGroup) ob.@Items[n3]), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
105                                         }\r
106                                         else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaComplexType)) {\r
107                                                 WriteObject_XmlSchemaComplexType (((System.Xml.Schema.XmlSchemaComplexType) ob.@Items[n3]), "complexType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
108                                         }\r
109                                         else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaNotation)) {\r
110                                                 WriteObject_XmlSchemaNotation (((System.Xml.Schema.XmlSchemaNotation) ob.@Items[n3]), "notation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
111                                         }\r
112                                         else throw CreateUnknownTypeException (ob.@Items[n3]);\r
113                                 }\r
114                         }\r
115                         if (writeWrappingElem) WriteEndElement (ob);\r
116                 }\r
117 \r
118                 void WriteObject_XmlSchemaForm (System.Xml.Schema.XmlSchemaForm ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
119                 {\r
120                         System.Type type = ob.GetType ();\r
121                         if (type == typeof(System.Xml.Schema.XmlSchemaForm))\r
122                                 ;\r
123                         else {\r
124                                 throw CreateUnknownTypeException (ob);\r
125                         }\r
126 \r
127                         if (writeWrappingElem) {\r
128                                 WriteStartElement (element, namesp, ob);\r
129                         }\r
130 \r
131                         if (needType) WriteXsiType("XmlSchemaForm", "");\r
132 \r
133                         Writer.WriteString (GetEnumValue_XmlSchemaForm (ob));\r
134                         if (writeWrappingElem) WriteEndElement (ob);\r
135                 }\r
136 \r
137                 string GetEnumValue_XmlSchemaForm (System.Xml.Schema.XmlSchemaForm val)\r
138                 {\r
139                         switch (val)\r
140                         {\r
141                                 case System.Xml.Schema.XmlSchemaForm.Qualified: return "qualified";\r
142                                 case System.Xml.Schema.XmlSchemaForm.Unqualified: return "unqualified";\r
143                                 default: return ((long)val).ToString(CultureInfo.InvariantCulture);\r
144                         }\r
145                 }\r
146 \r
147                 void WriteObject_XmlSchemaDerivationMethod (System.Xml.Schema.XmlSchemaDerivationMethod ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
148                 {\r
149                         System.Type type = ob.GetType ();\r
150                         if (type == typeof(System.Xml.Schema.XmlSchemaDerivationMethod))\r
151                                 ;\r
152                         else {\r
153                                 throw CreateUnknownTypeException (ob);\r
154                         }\r
155 \r
156                         if (writeWrappingElem) {\r
157                                 WriteStartElement (element, namesp, ob);\r
158                         }\r
159 \r
160                         if (needType) WriteXsiType("XmlSchemaDerivationMethod", "");\r
161 \r
162                         Writer.WriteString (GetEnumValue_XmlSchemaDerivationMethod (ob));\r
163                         if (writeWrappingElem) WriteEndElement (ob);\r
164                 }\r
165 \r
166                 string GetEnumValue_XmlSchemaDerivationMethod (System.Xml.Schema.XmlSchemaDerivationMethod val)\r
167                 {\r
168                         switch (val)\r
169                         {\r
170                                 case System.Xml.Schema.XmlSchemaDerivationMethod.Empty: return "";\r
171                                 case System.Xml.Schema.XmlSchemaDerivationMethod.Substitution: return "substitution";\r
172                                 case System.Xml.Schema.XmlSchemaDerivationMethod.Extension: return "extension";\r
173                                 case System.Xml.Schema.XmlSchemaDerivationMethod.Restriction: return "restriction";\r
174                                 case System.Xml.Schema.XmlSchemaDerivationMethod.List: return "list";\r
175                                 case System.Xml.Schema.XmlSchemaDerivationMethod.Union: return "union";\r
176                                 case System.Xml.Schema.XmlSchemaDerivationMethod.All: return "#all";\r
177                                 default:\r
178                                         System.Text.StringBuilder sb = new System.Text.StringBuilder ();\r
179                                         string[] enumNames = val.ToString().Split (',');\r
180                                         foreach (string name in enumNames)\r
181                                         {\r
182                                                 switch (name.Trim())\r
183                                                 {\r
184                                                         case "Empty": sb.Append ("").Append (' '); break; \r
185                                                         case "Substitution": sb.Append ("substitution").Append (' '); break; \r
186                                                         case "Extension": sb.Append ("extension").Append (' '); break; \r
187                                                         case "Restriction": sb.Append ("restriction").Append (' '); break; \r
188                                                         case "List": sb.Append ("list").Append (' '); break; \r
189                                                         case "Union": sb.Append ("union").Append (' '); break; \r
190                                                         case "All": sb.Append ("#all").Append (' '); break; \r
191                                                         default: sb.Append (name.Trim()).Append (' '); break; \r
192                                                 }\r
193                                         }\r
194                                         return sb.ToString ().Trim();\r
195                         }\r
196                 }\r
197 \r
198                 void WriteObject_XmlSchemaInclude (System.Xml.Schema.XmlSchemaInclude ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
199                 {\r
200                         if (ob == null)\r
201                         {\r
202                                 if (isNullable)\r
203                                         WriteNullTagLiteral(element, namesp);\r
204                                 return;\r
205                         }\r
206 \r
207                         System.Type type = ob.GetType ();\r
208                         if (type == typeof(System.Xml.Schema.XmlSchemaInclude))\r
209                                 ;\r
210                         else {\r
211                                 throw CreateUnknownTypeException (ob);\r
212                         }\r
213 \r
214                         if (writeWrappingElem) {\r
215                                 WriteStartElement (element, namesp, ob);\r
216                         }\r
217 \r
218                         if (needType) WriteXsiType("XmlSchemaInclude", "http://www.w3.org/2001/XMLSchema");\r
219 \r
220                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
221 \r
222                         ICollection o4 = ob.@UnhandledAttributes;\r
223                         if (o4 != null) {\r
224                                 foreach (XmlAttribute o5 in o4)\r
225                                         if (o5.NamespaceURI != xmlNamespace)\r
226                                                 WriteXmlAttribute (o5, ob);\r
227                         }\r
228 \r
229                         WriteAttribute ("schemaLocation", "", ob.@SchemaLocation);\r
230                         WriteAttribute ("id", "", ob.@Id);\r
231 \r
232                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
233                         if (writeWrappingElem) WriteEndElement (ob);\r
234                 }\r
235 \r
236                 void WriteObject_XmlSchemaImport (System.Xml.Schema.XmlSchemaImport ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
237                 {\r
238                         if (ob == null)\r
239                         {\r
240                                 if (isNullable)\r
241                                         WriteNullTagLiteral(element, namesp);\r
242                                 return;\r
243                         }\r
244 \r
245                         System.Type type = ob.GetType ();\r
246                         if (type == typeof(System.Xml.Schema.XmlSchemaImport))\r
247                                 ;\r
248                         else {\r
249                                 throw CreateUnknownTypeException (ob);\r
250                         }\r
251 \r
252                         if (writeWrappingElem) {\r
253                                 WriteStartElement (element, namesp, ob);\r
254                         }\r
255 \r
256                         if (needType) WriteXsiType("XmlSchemaImport", "http://www.w3.org/2001/XMLSchema");\r
257 \r
258                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
259 \r
260                         ICollection o6 = ob.@UnhandledAttributes;\r
261                         if (o6 != null) {\r
262                                 foreach (XmlAttribute o7 in o6)\r
263                                         if (o7.NamespaceURI != xmlNamespace)\r
264                                                 WriteXmlAttribute (o7, ob);\r
265                         }\r
266 \r
267                         WriteAttribute ("schemaLocation", "", ob.@SchemaLocation);\r
268                         WriteAttribute ("id", "", ob.@Id);\r
269                         WriteAttribute ("namespace", "", ob.@Namespace);\r
270 \r
271                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
272                         if (writeWrappingElem) WriteEndElement (ob);\r
273                 }\r
274 \r
275                 void WriteObject_XmlSchemaRedefine (System.Xml.Schema.XmlSchemaRedefine ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
276                 {\r
277                         if (ob == null)\r
278                         {\r
279                                 if (isNullable)\r
280                                         WriteNullTagLiteral(element, namesp);\r
281                                 return;\r
282                         }\r
283 \r
284                         System.Type type = ob.GetType ();\r
285                         if (type == typeof(System.Xml.Schema.XmlSchemaRedefine))\r
286                                 ;\r
287                         else {\r
288                                 throw CreateUnknownTypeException (ob);\r
289                         }\r
290 \r
291                         if (writeWrappingElem) {\r
292                                 WriteStartElement (element, namesp, ob);\r
293                         }\r
294 \r
295                         if (needType) WriteXsiType("XmlSchemaRedefine", "http://www.w3.org/2001/XMLSchema");\r
296 \r
297                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
298 \r
299                         ICollection o8 = ob.@UnhandledAttributes;\r
300                         if (o8 != null) {\r
301                                 foreach (XmlAttribute o9 in o8)\r
302                                         if (o9.NamespaceURI != xmlNamespace)\r
303                                                 WriteXmlAttribute (o9, ob);\r
304                         }\r
305 \r
306                         WriteAttribute ("schemaLocation", "", ob.@SchemaLocation);\r
307                         WriteAttribute ("id", "", ob.@Id);\r
308 \r
309                         if (ob.@Items != null) {\r
310                                 for (int n10 = 0; n10 < ob.@Items.Count; n10++) {\r
311                                         if (ob.@Items[n10] == null) { }\r
312                                         else if (ob.@Items[n10].GetType() == typeof(System.Xml.Schema.XmlSchemaGroup)) {\r
313                                                 WriteObject_XmlSchemaGroup (((System.Xml.Schema.XmlSchemaGroup) ob.@Items[n10]), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
314                                         }\r
315                                         else if (ob.@Items[n10].GetType() == typeof(System.Xml.Schema.XmlSchemaComplexType)) {\r
316                                                 WriteObject_XmlSchemaComplexType (((System.Xml.Schema.XmlSchemaComplexType) ob.@Items[n10]), "complexType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
317                                         }\r
318                                         else if (ob.@Items[n10].GetType() == typeof(System.Xml.Schema.XmlSchemaSimpleType)) {\r
319                                                 WriteObject_XmlSchemaSimpleType (((System.Xml.Schema.XmlSchemaSimpleType) ob.@Items[n10]), "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
320                                         }\r
321                                         else if (ob.@Items[n10].GetType() == typeof(System.Xml.Schema.XmlSchemaAnnotation)) {\r
322                                                 WriteObject_XmlSchemaAnnotation (((System.Xml.Schema.XmlSchemaAnnotation) ob.@Items[n10]), "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
323                                         }\r
324                                         else if (ob.@Items[n10].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroup)) {\r
325                                                 WriteObject_XmlSchemaAttributeGroup (((System.Xml.Schema.XmlSchemaAttributeGroup) ob.@Items[n10]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
326                                         }\r
327                                         else throw CreateUnknownTypeException (ob.@Items[n10]);\r
328                                 }\r
329                         }\r
330                         if (writeWrappingElem) WriteEndElement (ob);\r
331                 }\r
332 \r
333                 void WriteObject_XmlSchemaElement (System.Xml.Schema.XmlSchemaElement ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
334                 {\r
335                         if (ob == null)\r
336                         {\r
337                                 if (isNullable)\r
338                                         WriteNullTagLiteral(element, namesp);\r
339                                 return;\r
340                         }\r
341 \r
342                         System.Type type = ob.GetType ();\r
343                         if (type == typeof(System.Xml.Schema.XmlSchemaElement))\r
344                                 ;\r
345                         else {\r
346                                 throw CreateUnknownTypeException (ob);\r
347                         }\r
348 \r
349                         if (writeWrappingElem) {\r
350                                 WriteStartElement (element, namesp, ob);\r
351                         }\r
352 \r
353                         if (needType) WriteXsiType("XmlSchemaElement", "http://www.w3.org/2001/XMLSchema");\r
354 \r
355                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
356 \r
357                         ICollection o11 = ob.@UnhandledAttributes;\r
358                         if (o11 != null) {\r
359                                 foreach (XmlAttribute o12 in o11)\r
360                                         if (o12.NamespaceURI != xmlNamespace)\r
361                                                 WriteXmlAttribute (o12, ob);\r
362                         }\r
363 \r
364                         WriteAttribute ("id", "", ob.@Id);\r
365                         WriteAttribute ("minOccurs", "", ob.@MinOccursString);\r
366                         WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);\r
367                         if (ob.@IsAbstract != false) {\r
368                                 WriteAttribute ("abstract", "", (ob.@IsAbstract?"true":"false"));\r
369                         }\r
370                         if (ob.@Block != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {\r
371                                 WriteAttribute ("block", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@Block));\r
372                         }\r
373                         if (ob.@DefaultValue != null) {\r
374                                 WriteAttribute ("default", "", ob.@DefaultValue);\r
375                         }\r
376                         if (ob.@Final != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {\r
377                                 WriteAttribute ("final", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@Final));\r
378                         }\r
379                         if (ob.@FixedValue != null) {\r
380                                 WriteAttribute ("fixed", "", ob.@FixedValue);\r
381                         }\r
382                         if (ob.@Form != ((System.Xml.Schema.XmlSchemaForm) System.Xml.Schema.XmlSchemaForm.None)) {\r
383                                 WriteAttribute ("form", "", GetEnumValue_XmlSchemaForm (ob.@Form));\r
384                         }\r
385                         if (ob.@Name != null) {\r
386                                 WriteAttribute ("name", "", ob.@Name);\r
387                         }\r
388                         if (ob.@IsNillable != false) {\r
389                                 WriteAttribute ("nillable", "", (ob.@IsNillable?"true":"false"));\r
390                         }\r
391                         WriteAttribute ("ref", "", FromXmlQualifiedName (ob.@RefName));\r
392                         WriteAttribute ("substitutionGroup", "", FromXmlQualifiedName (ob.@SubstitutionGroup));\r
393                         WriteAttribute ("type", "", FromXmlQualifiedName (ob.@SchemaTypeName));\r
394 \r
395                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
396                         if (ob.@SchemaType is System.Xml.Schema.XmlSchemaSimpleType) {\r
397                                 WriteObject_XmlSchemaSimpleType (((System.Xml.Schema.XmlSchemaSimpleType) ob.@SchemaType), "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
398                         }\r
399                         else if (ob.@SchemaType is System.Xml.Schema.XmlSchemaComplexType) {\r
400                                 WriteObject_XmlSchemaComplexType (((System.Xml.Schema.XmlSchemaComplexType) ob.@SchemaType), "complexType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
401                         }\r
402                         if (ob.@Constraints != null) {\r
403                                 for (int n13 = 0; n13 < ob.@Constraints.Count; n13++) {\r
404                                         if (ob.@Constraints[n13] == null) { }\r
405                                         else if (ob.@Constraints[n13].GetType() == typeof(System.Xml.Schema.XmlSchemaKeyref)) {\r
406                                                 WriteObject_XmlSchemaKeyref (((System.Xml.Schema.XmlSchemaKeyref) ob.@Constraints[n13]), "keyref", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
407                                         }\r
408                                         else if (ob.@Constraints[n13].GetType() == typeof(System.Xml.Schema.XmlSchemaKey)) {\r
409                                                 WriteObject_XmlSchemaKey (((System.Xml.Schema.XmlSchemaKey) ob.@Constraints[n13]), "key", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
410                                         }\r
411                                         else if (ob.@Constraints[n13].GetType() == typeof(System.Xml.Schema.XmlSchemaUnique)) {\r
412                                                 WriteObject_XmlSchemaUnique (((System.Xml.Schema.XmlSchemaUnique) ob.@Constraints[n13]), "unique", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
413                                         }\r
414                                         else throw CreateUnknownTypeException (ob.@Constraints[n13]);\r
415                                 }\r
416                         }\r
417                         if (writeWrappingElem) WriteEndElement (ob);\r
418                 }\r
419 \r
420                 void WriteObject_XmlSchemaSimpleType (System.Xml.Schema.XmlSchemaSimpleType ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
421                 {\r
422                         if (ob == null)\r
423                         {\r
424                                 if (isNullable)\r
425                                         WriteNullTagLiteral(element, namesp);\r
426                                 return;\r
427                         }\r
428 \r
429                         System.Type type = ob.GetType ();\r
430                         if (type == typeof(System.Xml.Schema.XmlSchemaSimpleType))\r
431                                 ;\r
432                         else {\r
433                                 throw CreateUnknownTypeException (ob);\r
434                         }\r
435 \r
436                         if (writeWrappingElem) {\r
437                                 WriteStartElement (element, namesp, ob);\r
438                         }\r
439 \r
440                         if (needType) WriteXsiType("XmlSchemaSimpleType", "http://www.w3.org/2001/XMLSchema");\r
441 \r
442                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
443 \r
444                         ICollection o14 = ob.@UnhandledAttributes;\r
445                         if (o14 != null) {\r
446                                 foreach (XmlAttribute o15 in o14)\r
447                                         if (o15.NamespaceURI != xmlNamespace)\r
448                                                 WriteXmlAttribute (o15, ob);\r
449                         }\r
450 \r
451                         WriteAttribute ("id", "", ob.@Id);\r
452                         WriteAttribute ("name", "", ob.@Name);\r
453                         if (ob.@Final != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {\r
454                                 WriteAttribute ("final", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@Final));\r
455                         }\r
456 \r
457                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
458                         if (ob.@Content is System.Xml.Schema.XmlSchemaSimpleTypeUnion) {\r
459                                 WriteObject_XmlSchemaSimpleTypeUnion (((System.Xml.Schema.XmlSchemaSimpleTypeUnion) ob.@Content), "union", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
460                         }\r
461                         else if (ob.@Content is System.Xml.Schema.XmlSchemaSimpleTypeList) {\r
462                                 WriteObject_XmlSchemaSimpleTypeList (((System.Xml.Schema.XmlSchemaSimpleTypeList) ob.@Content), "list", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
463                         }\r
464                         else if (ob.@Content is System.Xml.Schema.XmlSchemaSimpleTypeRestriction) {\r
465                                 WriteObject_XmlSchemaSimpleTypeRestriction (((System.Xml.Schema.XmlSchemaSimpleTypeRestriction) ob.@Content), "restriction", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
466                         }\r
467                         if (writeWrappingElem) WriteEndElement (ob);\r
468                 }\r
469 \r
470                 void WriteObject_XmlSchemaAttribute (System.Xml.Schema.XmlSchemaAttribute ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
471                 {\r
472                         if (ob == null)\r
473                         {\r
474                                 if (isNullable)\r
475                                         WriteNullTagLiteral(element, namesp);\r
476                                 return;\r
477                         }\r
478 \r
479                         System.Type type = ob.GetType ();\r
480                         if (type == typeof(System.Xml.Schema.XmlSchemaAttribute))\r
481                                 ;\r
482                         else {\r
483                                 throw CreateUnknownTypeException (ob);\r
484                         }\r
485 \r
486                         if (writeWrappingElem) {\r
487                                 WriteStartElement (element, namesp, ob);\r
488                         }\r
489 \r
490                         if (needType) WriteXsiType("XmlSchemaAttribute", "http://www.w3.org/2001/XMLSchema");\r
491 \r
492                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
493 \r
494                         ICollection o16 = ob.@UnhandledAttributes;\r
495                         if (o16 != null) {\r
496                                 foreach (XmlAttribute o17 in o16)\r
497                                         if (o17.NamespaceURI != xmlNamespace)\r
498                                                 WriteXmlAttribute (o17, ob);\r
499                         }\r
500 \r
501                         WriteAttribute ("id", "", ob.@Id);\r
502                         if (ob.@DefaultValue != null) {\r
503                                 WriteAttribute ("default", "", ob.@DefaultValue);\r
504                         }\r
505                         if (ob.@FixedValue != null) {\r
506                                 WriteAttribute ("fixed", "", ob.@FixedValue);\r
507                         }\r
508                         if (ob.@Form != ((System.Xml.Schema.XmlSchemaForm) System.Xml.Schema.XmlSchemaForm.None)) {\r
509                                 WriteAttribute ("form", "", GetEnumValue_XmlSchemaForm (ob.@Form));\r
510                         }\r
511                         WriteAttribute ("name", "", ob.@Name);\r
512                         WriteAttribute ("ref", "", FromXmlQualifiedName (ob.@RefName));\r
513                         WriteAttribute ("type", "", FromXmlQualifiedName (ob.@SchemaTypeName));\r
514                         if (ob.@Use != ((System.Xml.Schema.XmlSchemaUse) System.Xml.Schema.XmlSchemaUse.None)) {\r
515                                 WriteAttribute ("use", "", GetEnumValue_XmlSchemaUse (ob.@Use));\r
516                         }\r
517 \r
518                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
519                         WriteObject_XmlSchemaSimpleType (ob.@SchemaType, "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
520                         if (writeWrappingElem) WriteEndElement (ob);\r
521                 }\r
522 \r
523                 void WriteObject_XmlSchemaAnnotation (System.Xml.Schema.XmlSchemaAnnotation ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
524                 {\r
525                         if (ob == null)\r
526                         {\r
527                                 if (isNullable)\r
528                                         WriteNullTagLiteral(element, namesp);\r
529                                 return;\r
530                         }\r
531 \r
532                         System.Type type = ob.GetType ();\r
533                         if (type == typeof(System.Xml.Schema.XmlSchemaAnnotation))\r
534                                 ;\r
535                         else {\r
536                                 throw CreateUnknownTypeException (ob);\r
537                         }\r
538 \r
539                         if (writeWrappingElem) {\r
540                                 WriteStartElement (element, namesp, ob);\r
541                         }\r
542 \r
543                         if (needType) WriteXsiType("XmlSchemaAnnotation", "http://www.w3.org/2001/XMLSchema");\r
544 \r
545                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
546 \r
547                         ICollection o18 = ob.@UnhandledAttributes;\r
548                         if (o18 != null) {\r
549                                 foreach (XmlAttribute o19 in o18)\r
550                                         if (o19.NamespaceURI != xmlNamespace)\r
551                                                 WriteXmlAttribute (o19, ob);\r
552                         }\r
553 \r
554                         WriteAttribute ("id", "", ob.@Id);\r
555 \r
556                         if (ob.@Items != null) {\r
557                                 for (int n20 = 0; n20 < ob.@Items.Count; n20++) {\r
558                                         if (ob.@Items[n20] == null) { }\r
559                                         else if (ob.@Items[n20].GetType() == typeof(System.Xml.Schema.XmlSchemaAppInfo)) {\r
560                                                 WriteObject_XmlSchemaAppInfo (((System.Xml.Schema.XmlSchemaAppInfo) ob.@Items[n20]), "appinfo", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
561                                         }\r
562                                         else if (ob.@Items[n20].GetType() == typeof(System.Xml.Schema.XmlSchemaDocumentation)) {\r
563                                                 WriteObject_XmlSchemaDocumentation (((System.Xml.Schema.XmlSchemaDocumentation) ob.@Items[n20]), "documentation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
564                                         }\r
565                                         else throw CreateUnknownTypeException (ob.@Items[n20]);\r
566                                 }\r
567                         }\r
568                         if (writeWrappingElem) WriteEndElement (ob);\r
569                 }\r
570 \r
571                 void WriteObject_XmlSchemaAttributeGroup (System.Xml.Schema.XmlSchemaAttributeGroup ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
572                 {\r
573                         if (ob == null)\r
574                         {\r
575                                 if (isNullable)\r
576                                         WriteNullTagLiteral(element, namesp);\r
577                                 return;\r
578                         }\r
579 \r
580                         System.Type type = ob.GetType ();\r
581                         if (type == typeof(System.Xml.Schema.XmlSchemaAttributeGroup))\r
582                                 ;\r
583                         else {\r
584                                 throw CreateUnknownTypeException (ob);\r
585                         }\r
586 \r
587                         if (writeWrappingElem) {\r
588                                 WriteStartElement (element, namesp, ob);\r
589                         }\r
590 \r
591                         if (needType) WriteXsiType("XmlSchemaAttributeGroup", "http://www.w3.org/2001/XMLSchema");\r
592 \r
593                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
594 \r
595                         ICollection o21 = ob.@UnhandledAttributes;\r
596                         if (o21 != null) {\r
597                                 foreach (XmlAttribute o22 in o21)\r
598                                         if (o22.NamespaceURI != xmlNamespace)\r
599                                                 WriteXmlAttribute (o22, ob);\r
600                         }\r
601 \r
602                         WriteAttribute ("id", "", ob.@Id);\r
603                         WriteAttribute ("name", "", ob.@Name);\r
604 \r
605                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
606                         if (ob.@Attributes != null) {\r
607                                 for (int n23 = 0; n23 < ob.@Attributes.Count; n23++) {\r
608                                         if (ob.@Attributes[n23] == null) { }\r
609                                         else if (ob.@Attributes[n23].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {\r
610                                                 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n23]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
611                                         }\r
612                                         else if (ob.@Attributes[n23].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {\r
613                                                 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n23]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
614                                         }\r
615                                         else throw CreateUnknownTypeException (ob.@Attributes[n23]);\r
616                                 }\r
617                         }\r
618                         WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
619                         if (writeWrappingElem) WriteEndElement (ob);\r
620                 }\r
621 \r
622                 void WriteObject_XmlSchemaGroup (System.Xml.Schema.XmlSchemaGroup ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
623                 {\r
624                         if (ob == null)\r
625                         {\r
626                                 if (isNullable)\r
627                                         WriteNullTagLiteral(element, namesp);\r
628                                 return;\r
629                         }\r
630 \r
631                         System.Type type = ob.GetType ();\r
632                         if (type == typeof(System.Xml.Schema.XmlSchemaGroup))\r
633                                 ;\r
634                         else {\r
635                                 throw CreateUnknownTypeException (ob);\r
636                         }\r
637 \r
638                         if (writeWrappingElem) {\r
639                                 WriteStartElement (element, namesp, ob);\r
640                         }\r
641 \r
642                         if (needType) WriteXsiType("XmlSchemaGroup", "http://www.w3.org/2001/XMLSchema");\r
643 \r
644                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
645 \r
646                         ICollection o24 = ob.@UnhandledAttributes;\r
647                         if (o24 != null) {\r
648                                 foreach (XmlAttribute o25 in o24)\r
649                                         if (o25.NamespaceURI != xmlNamespace)\r
650                                                 WriteXmlAttribute (o25, ob);\r
651                         }\r
652 \r
653                         WriteAttribute ("id", "", ob.@Id);\r
654                         WriteAttribute ("name", "", ob.@Name);\r
655 \r
656                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
657                         if (ob.@Particle is System.Xml.Schema.XmlSchemaSequence) {\r
658                                 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Particle), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
659                         }\r
660                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaChoice) {\r
661                                 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Particle), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
662                         }\r
663                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaAll) {\r
664                                 WriteObject_XmlSchemaAll (((System.Xml.Schema.XmlSchemaAll) ob.@Particle), "all", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
665                         }\r
666                         if (writeWrappingElem) WriteEndElement (ob);\r
667                 }\r
668 \r
669                 void WriteObject_XmlSchemaComplexType (System.Xml.Schema.XmlSchemaComplexType ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
670                 {\r
671                         if (ob == null)\r
672                         {\r
673                                 if (isNullable)\r
674                                         WriteNullTagLiteral(element, namesp);\r
675                                 return;\r
676                         }\r
677 \r
678                         System.Type type = ob.GetType ();\r
679                         if (type == typeof(System.Xml.Schema.XmlSchemaComplexType))\r
680                                 ;\r
681                         else {\r
682                                 throw CreateUnknownTypeException (ob);\r
683                         }\r
684 \r
685                         if (writeWrappingElem) {\r
686                                 WriteStartElement (element, namesp, ob);\r
687                         }\r
688 \r
689                         if (needType) WriteXsiType("XmlSchemaComplexType", "http://www.w3.org/2001/XMLSchema");\r
690 \r
691                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
692 \r
693                         ICollection o26 = ob.@UnhandledAttributes;\r
694                         if (o26 != null) {\r
695                                 foreach (XmlAttribute o27 in o26)\r
696                                         if (o27.NamespaceURI != xmlNamespace)\r
697                                                 WriteXmlAttribute (o27, ob);\r
698                         }\r
699 \r
700                         WriteAttribute ("id", "", ob.@Id);\r
701                         WriteAttribute ("name", "", ob.@Name);\r
702                         if (ob.@Final != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {\r
703                                 WriteAttribute ("final", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@Final));\r
704                         }\r
705                         if (ob.@IsAbstract != false) {\r
706                                 WriteAttribute ("abstract", "", (ob.@IsAbstract?"true":"false"));\r
707                         }\r
708                         if (ob.@Block != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {\r
709                                 WriteAttribute ("block", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@Block));\r
710                         }\r
711                         if (ob.@IsMixed != false) {\r
712                                 WriteAttribute ("mixed", "", (ob.@IsMixed?"true":"false"));\r
713                         }\r
714 \r
715                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
716                         if (ob.@ContentModel is System.Xml.Schema.XmlSchemaComplexContent) {\r
717                                 WriteObject_XmlSchemaComplexContent (((System.Xml.Schema.XmlSchemaComplexContent) ob.@ContentModel), "complexContent", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
718                         }\r
719                         else if (ob.@ContentModel is System.Xml.Schema.XmlSchemaSimpleContent) {\r
720                                 WriteObject_XmlSchemaSimpleContent (((System.Xml.Schema.XmlSchemaSimpleContent) ob.@ContentModel), "simpleContent", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
721                         }\r
722                         if (ob.@Particle is System.Xml.Schema.XmlSchemaAll) {\r
723                                 WriteObject_XmlSchemaAll (((System.Xml.Schema.XmlSchemaAll) ob.@Particle), "all", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
724                         }\r
725                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaGroupRef) {\r
726                                 WriteObject_XmlSchemaGroupRef (((System.Xml.Schema.XmlSchemaGroupRef) ob.@Particle), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
727                         }\r
728                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaSequence) {\r
729                                 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Particle), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
730                         }\r
731                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaChoice) {\r
732                                 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Particle), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
733                         }\r
734                         if (ob.@Attributes != null) {\r
735                                 for (int n28 = 0; n28 < ob.@Attributes.Count; n28++) {\r
736                                         if (ob.@Attributes[n28] == null) { }\r
737                                         else if (ob.@Attributes[n28].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {\r
738                                                 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n28]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
739                                         }\r
740                                         else if (ob.@Attributes[n28].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {\r
741                                                 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n28]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
742                                         }\r
743                                         else throw CreateUnknownTypeException (ob.@Attributes[n28]);\r
744                                 }\r
745                         }\r
746                         WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
747                         if (writeWrappingElem) WriteEndElement (ob);\r
748                 }\r
749 \r
750                 void WriteObject_XmlSchemaNotation (System.Xml.Schema.XmlSchemaNotation ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
751                 {\r
752                         if (ob == null)\r
753                         {\r
754                                 if (isNullable)\r
755                                         WriteNullTagLiteral(element, namesp);\r
756                                 return;\r
757                         }\r
758 \r
759                         System.Type type = ob.GetType ();\r
760                         if (type == typeof(System.Xml.Schema.XmlSchemaNotation))\r
761                                 ;\r
762                         else {\r
763                                 throw CreateUnknownTypeException (ob);\r
764                         }\r
765 \r
766                         if (writeWrappingElem) {\r
767                                 WriteStartElement (element, namesp, ob);\r
768                         }\r
769 \r
770                         if (needType) WriteXsiType("XmlSchemaNotation", "http://www.w3.org/2001/XMLSchema");\r
771 \r
772                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
773 \r
774                         ICollection o29 = ob.@UnhandledAttributes;\r
775                         if (o29 != null) {\r
776                                 foreach (XmlAttribute o30 in o29)\r
777                                         if (o30.NamespaceURI != xmlNamespace)\r
778                                                 WriteXmlAttribute (o30, ob);\r
779                         }\r
780 \r
781                         WriteAttribute ("id", "", ob.@Id);\r
782                         WriteAttribute ("name", "", ob.@Name);\r
783                         WriteAttribute ("public", "", ob.@Public);\r
784                         WriteAttribute ("system", "", ob.@System);\r
785 \r
786                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
787                         if (writeWrappingElem) WriteEndElement (ob);\r
788                 }\r
789 \r
790                 void WriteObject_XmlSchemaKeyref (System.Xml.Schema.XmlSchemaKeyref ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
791                 {\r
792                         if (ob == null)\r
793                         {\r
794                                 if (isNullable)\r
795                                         WriteNullTagLiteral(element, namesp);\r
796                                 return;\r
797                         }\r
798 \r
799                         System.Type type = ob.GetType ();\r
800                         if (type == typeof(System.Xml.Schema.XmlSchemaKeyref))\r
801                                 ;\r
802                         else {\r
803                                 throw CreateUnknownTypeException (ob);\r
804                         }\r
805 \r
806                         if (writeWrappingElem) {\r
807                                 WriteStartElement (element, namesp, ob);\r
808                         }\r
809 \r
810                         if (needType) WriteXsiType("XmlSchemaKeyref", "http://www.w3.org/2001/XMLSchema");\r
811 \r
812                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
813 \r
814                         ICollection o31 = ob.@UnhandledAttributes;\r
815                         if (o31 != null) {\r
816                                 foreach (XmlAttribute o32 in o31)\r
817                                         if (o32.NamespaceURI != xmlNamespace)\r
818                                                 WriteXmlAttribute (o32, ob);\r
819                         }\r
820 \r
821                         WriteAttribute ("id", "", ob.@Id);\r
822                         WriteAttribute ("name", "", ob.@Name);\r
823                         WriteAttribute ("refer", "", FromXmlQualifiedName (ob.@Refer));\r
824 \r
825                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
826                         WriteObject_XmlSchemaXPath (ob.@Selector, "selector", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
827                         if (ob.@Fields != null) {\r
828                                 for (int n33 = 0; n33 < ob.@Fields.Count; n33++) {\r
829                                         WriteObject_XmlSchemaXPath (((System.Xml.Schema.XmlSchemaXPath) ob.@Fields[n33]), "field", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
830                                 }\r
831                         }\r
832                         if (writeWrappingElem) WriteEndElement (ob);\r
833                 }\r
834 \r
835                 void WriteObject_XmlSchemaKey (System.Xml.Schema.XmlSchemaKey ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
836                 {\r
837                         if (ob == null)\r
838                         {\r
839                                 if (isNullable)\r
840                                         WriteNullTagLiteral(element, namesp);\r
841                                 return;\r
842                         }\r
843 \r
844                         System.Type type = ob.GetType ();\r
845                         if (type == typeof(System.Xml.Schema.XmlSchemaKey))\r
846                                 ;\r
847                         else {\r
848                                 throw CreateUnknownTypeException (ob);\r
849                         }\r
850 \r
851                         if (writeWrappingElem) {\r
852                                 WriteStartElement (element, namesp, ob);\r
853                         }\r
854 \r
855                         if (needType) WriteXsiType("XmlSchemaKey", "http://www.w3.org/2001/XMLSchema");\r
856 \r
857                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
858 \r
859                         ICollection o34 = ob.@UnhandledAttributes;\r
860                         if (o34 != null) {\r
861                                 foreach (XmlAttribute o35 in o34)\r
862                                         if (o35.NamespaceURI != xmlNamespace)\r
863                                                 WriteXmlAttribute (o35, ob);\r
864                         }\r
865 \r
866                         WriteAttribute ("id", "", ob.@Id);\r
867                         WriteAttribute ("name", "", ob.@Name);\r
868 \r
869                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
870                         WriteObject_XmlSchemaXPath (ob.@Selector, "selector", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
871                         if (ob.@Fields != null) {\r
872                                 for (int n36 = 0; n36 < ob.@Fields.Count; n36++) {\r
873                                         WriteObject_XmlSchemaXPath (((System.Xml.Schema.XmlSchemaXPath) ob.@Fields[n36]), "field", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
874                                 }\r
875                         }\r
876                         if (writeWrappingElem) WriteEndElement (ob);\r
877                 }\r
878 \r
879                 void WriteObject_XmlSchemaUnique (System.Xml.Schema.XmlSchemaUnique ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
880                 {\r
881                         if (ob == null)\r
882                         {\r
883                                 if (isNullable)\r
884                                         WriteNullTagLiteral(element, namesp);\r
885                                 return;\r
886                         }\r
887 \r
888                         System.Type type = ob.GetType ();\r
889                         if (type == typeof(System.Xml.Schema.XmlSchemaUnique))\r
890                                 ;\r
891                         else {\r
892                                 throw CreateUnknownTypeException (ob);\r
893                         }\r
894 \r
895                         if (writeWrappingElem) {\r
896                                 WriteStartElement (element, namesp, ob);\r
897                         }\r
898 \r
899                         if (needType) WriteXsiType("XmlSchemaUnique", "http://www.w3.org/2001/XMLSchema");\r
900 \r
901                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
902 \r
903                         ICollection o37 = ob.@UnhandledAttributes;\r
904                         if (o37 != null) {\r
905                                 foreach (XmlAttribute o38 in o37)\r
906                                         if (o38.NamespaceURI != xmlNamespace)\r
907                                                 WriteXmlAttribute (o38, ob);\r
908                         }\r
909 \r
910                         WriteAttribute ("id", "", ob.@Id);\r
911                         WriteAttribute ("name", "", ob.@Name);\r
912 \r
913                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
914                         WriteObject_XmlSchemaXPath (ob.@Selector, "selector", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
915                         if (ob.@Fields != null) {\r
916                                 for (int n39 = 0; n39 < ob.@Fields.Count; n39++) {\r
917                                         WriteObject_XmlSchemaXPath (((System.Xml.Schema.XmlSchemaXPath) ob.@Fields[n39]), "field", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
918                                 }\r
919                         }\r
920                         if (writeWrappingElem) WriteEndElement (ob);\r
921                 }\r
922 \r
923                 void WriteObject_XmlSchemaSimpleTypeUnion (System.Xml.Schema.XmlSchemaSimpleTypeUnion ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
924                 {\r
925                         if (ob == null)\r
926                         {\r
927                                 if (isNullable)\r
928                                         WriteNullTagLiteral(element, namesp);\r
929                                 return;\r
930                         }\r
931 \r
932                         System.Type type = ob.GetType ();\r
933                         if (type == typeof(System.Xml.Schema.XmlSchemaSimpleTypeUnion))\r
934                                 ;\r
935                         else {\r
936                                 throw CreateUnknownTypeException (ob);\r
937                         }\r
938 \r
939                         if (writeWrappingElem) {\r
940                                 WriteStartElement (element, namesp, ob);\r
941                         }\r
942 \r
943                         if (needType) WriteXsiType("XmlSchemaSimpleTypeUnion", "http://www.w3.org/2001/XMLSchema");\r
944 \r
945                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
946 \r
947                         ICollection o40 = ob.@UnhandledAttributes;\r
948                         if (o40 != null) {\r
949                                 foreach (XmlAttribute o41 in o40)\r
950                                         if (o41.NamespaceURI != xmlNamespace)\r
951                                                 WriteXmlAttribute (o41, ob);\r
952                         }\r
953 \r
954                         WriteAttribute ("id", "", ob.@Id);\r
955                         string s42 = null;\r
956                         if (ob.@MemberTypes != null) {\r
957                                 System.Text.StringBuilder s43 = new System.Text.StringBuilder();\r
958                                 for (int n44 = 0; n44 < ob.@MemberTypes.Length; n44++) {\r
959                                         s43.Append (FromXmlQualifiedName (ob.@MemberTypes[n44])).Append (" ");\r
960                                 }\r
961                                 s42 = s43.ToString ().Trim ();\r
962                         }\r
963                         WriteAttribute ("memberTypes", "", s42);\r
964 \r
965                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
966                         if (ob.@BaseTypes != null) {\r
967                                 for (int n45 = 0; n45 < ob.@BaseTypes.Count; n45++) {\r
968                                         WriteObject_XmlSchemaSimpleType (((System.Xml.Schema.XmlSchemaSimpleType) ob.@BaseTypes[n45]), "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
969                                 }\r
970                         }\r
971                         if (writeWrappingElem) WriteEndElement (ob);\r
972                 }\r
973 \r
974                 void WriteObject_XmlSchemaSimpleTypeList (System.Xml.Schema.XmlSchemaSimpleTypeList ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
975                 {\r
976                         if (ob == null)\r
977                         {\r
978                                 if (isNullable)\r
979                                         WriteNullTagLiteral(element, namesp);\r
980                                 return;\r
981                         }\r
982 \r
983                         System.Type type = ob.GetType ();\r
984                         if (type == typeof(System.Xml.Schema.XmlSchemaSimpleTypeList))\r
985                                 ;\r
986                         else {\r
987                                 throw CreateUnknownTypeException (ob);\r
988                         }\r
989 \r
990                         if (writeWrappingElem) {\r
991                                 WriteStartElement (element, namesp, ob);\r
992                         }\r
993 \r
994                         if (needType) WriteXsiType("XmlSchemaSimpleTypeList", "http://www.w3.org/2001/XMLSchema");\r
995 \r
996                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
997 \r
998                         ICollection o46 = ob.@UnhandledAttributes;\r
999                         if (o46 != null) {\r
1000                                 foreach (XmlAttribute o47 in o46)\r
1001                                         if (o47.NamespaceURI != xmlNamespace)\r
1002                                                 WriteXmlAttribute (o47, ob);\r
1003                         }\r
1004 \r
1005                         WriteAttribute ("id", "", ob.@Id);\r
1006                         WriteAttribute ("itemType", "", FromXmlQualifiedName (ob.@ItemTypeName));\r
1007 \r
1008                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1009                         WriteObject_XmlSchemaSimpleType (ob.@ItemType, "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1010                         if (writeWrappingElem) WriteEndElement (ob);\r
1011                 }\r
1012 \r
1013                 void WriteObject_XmlSchemaSimpleTypeRestriction (System.Xml.Schema.XmlSchemaSimpleTypeRestriction ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1014                 {\r
1015                         if (ob == null)\r
1016                         {\r
1017                                 if (isNullable)\r
1018                                         WriteNullTagLiteral(element, namesp);\r
1019                                 return;\r
1020                         }\r
1021 \r
1022                         System.Type type = ob.GetType ();\r
1023                         if (type == typeof(System.Xml.Schema.XmlSchemaSimpleTypeRestriction))\r
1024                                 ;\r
1025                         else {\r
1026                                 throw CreateUnknownTypeException (ob);\r
1027                         }\r
1028 \r
1029                         if (writeWrappingElem) {\r
1030                                 WriteStartElement (element, namesp, ob);\r
1031                         }\r
1032 \r
1033                         if (needType) WriteXsiType("XmlSchemaSimpleTypeRestriction", "http://www.w3.org/2001/XMLSchema");\r
1034 \r
1035                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1036 \r
1037                         ICollection o48 = ob.@UnhandledAttributes;\r
1038                         if (o48 != null) {\r
1039                                 foreach (XmlAttribute o49 in o48)\r
1040                                         if (o49.NamespaceURI != xmlNamespace)\r
1041                                                 WriteXmlAttribute (o49, ob);\r
1042                         }\r
1043 \r
1044                         WriteAttribute ("id", "", ob.@Id);\r
1045                         WriteAttribute ("base", "", FromXmlQualifiedName (ob.@BaseTypeName));\r
1046 \r
1047                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1048                         WriteObject_XmlSchemaSimpleType (ob.@BaseType, "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1049                         if (ob.@Facets != null) {\r
1050                                 for (int n50 = 0; n50 < ob.@Facets.Count; n50++) {\r
1051                                         if (ob.@Facets[n50] == null) { }\r
1052                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxLengthFacet)) {\r
1053                                                 WriteObject_XmlSchemaMaxLengthFacet (((System.Xml.Schema.XmlSchemaMaxLengthFacet) ob.@Facets[n50]), "maxLength", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1054                                         }\r
1055                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMinLengthFacet)) {\r
1056                                                 WriteObject_XmlSchemaMinLengthFacet (((System.Xml.Schema.XmlSchemaMinLengthFacet) ob.@Facets[n50]), "minLength", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1057                                         }\r
1058                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaLengthFacet)) {\r
1059                                                 WriteObject_XmlSchemaLengthFacet (((System.Xml.Schema.XmlSchemaLengthFacet) ob.@Facets[n50]), "length", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1060                                         }\r
1061                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaFractionDigitsFacet)) {\r
1062                                                 WriteObject_XmlSchemaFractionDigitsFacet (((System.Xml.Schema.XmlSchemaFractionDigitsFacet) ob.@Facets[n50]), "fractionDigits", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1063                                         }\r
1064                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxInclusiveFacet)) {\r
1065                                                 WriteObject_XmlSchemaMaxInclusiveFacet (((System.Xml.Schema.XmlSchemaMaxInclusiveFacet) ob.@Facets[n50]), "maxInclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1066                                         }\r
1067                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxExclusiveFacet)) {\r
1068                                                 WriteObject_XmlSchemaMaxExclusiveFacet (((System.Xml.Schema.XmlSchemaMaxExclusiveFacet) ob.@Facets[n50]), "maxExclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1069                                         }\r
1070                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMinExclusiveFacet)) {\r
1071                                                 WriteObject_XmlSchemaMinExclusiveFacet (((System.Xml.Schema.XmlSchemaMinExclusiveFacet) ob.@Facets[n50]), "minExclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1072                                         }\r
1073                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaEnumerationFacet)) {\r
1074                                                 WriteObject_XmlSchemaEnumerationFacet (((System.Xml.Schema.XmlSchemaEnumerationFacet) ob.@Facets[n50]), "enumeration", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1075                                         }\r
1076                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaTotalDigitsFacet)) {\r
1077                                                 WriteObject_XmlSchemaTotalDigitsFacet (((System.Xml.Schema.XmlSchemaTotalDigitsFacet) ob.@Facets[n50]), "totalDigits", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1078                                         }\r
1079                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMinInclusiveFacet)) {\r
1080                                                 WriteObject_XmlSchemaMinInclusiveFacet (((System.Xml.Schema.XmlSchemaMinInclusiveFacet) ob.@Facets[n50]), "minInclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1081                                         }\r
1082                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaWhiteSpaceFacet)) {\r
1083                                                 WriteObject_XmlSchemaWhiteSpaceFacet (((System.Xml.Schema.XmlSchemaWhiteSpaceFacet) ob.@Facets[n50]), "whiteSpace", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1084                                         }\r
1085                                         else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaPatternFacet)) {\r
1086                                                 WriteObject_XmlSchemaPatternFacet (((System.Xml.Schema.XmlSchemaPatternFacet) ob.@Facets[n50]), "pattern", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1087                                         }\r
1088                                         else throw CreateUnknownTypeException (ob.@Facets[n50]);\r
1089                                 }\r
1090                         }\r
1091                         if (writeWrappingElem) WriteEndElement (ob);\r
1092                 }\r
1093 \r
1094                 void WriteObject_XmlSchemaUse (System.Xml.Schema.XmlSchemaUse ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1095                 {\r
1096                         System.Type type = ob.GetType ();\r
1097                         if (type == typeof(System.Xml.Schema.XmlSchemaUse))\r
1098                                 ;\r
1099                         else {\r
1100                                 throw CreateUnknownTypeException (ob);\r
1101                         }\r
1102 \r
1103                         if (writeWrappingElem) {\r
1104                                 WriteStartElement (element, namesp, ob);\r
1105                         }\r
1106 \r
1107                         if (needType) WriteXsiType("XmlSchemaUse", "");\r
1108 \r
1109                         Writer.WriteString (GetEnumValue_XmlSchemaUse (ob));\r
1110                         if (writeWrappingElem) WriteEndElement (ob);\r
1111                 }\r
1112 \r
1113                 string GetEnumValue_XmlSchemaUse (System.Xml.Schema.XmlSchemaUse val)\r
1114                 {\r
1115                         switch (val)\r
1116                         {\r
1117                                 case System.Xml.Schema.XmlSchemaUse.Optional: return "optional";\r
1118                                 case System.Xml.Schema.XmlSchemaUse.Prohibited: return "prohibited";\r
1119                                 case System.Xml.Schema.XmlSchemaUse.Required: return "required";\r
1120                                 default: return ((long)val).ToString(CultureInfo.InvariantCulture);\r
1121                         }\r
1122                 }\r
1123 \r
1124                 void WriteObject_XmlSchemaAppInfo (System.Xml.Schema.XmlSchemaAppInfo ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1125                 {\r
1126                         if (ob == null)\r
1127                         {\r
1128                                 if (isNullable)\r
1129                                         WriteNullTagLiteral(element, namesp);\r
1130                                 return;\r
1131                         }\r
1132 \r
1133                         System.Type type = ob.GetType ();\r
1134                         if (type == typeof(System.Xml.Schema.XmlSchemaAppInfo))\r
1135                                 ;\r
1136                         else {\r
1137                                 throw CreateUnknownTypeException (ob);\r
1138                         }\r
1139 \r
1140                         if (writeWrappingElem) {\r
1141                                 WriteStartElement (element, namesp, ob);\r
1142                         }\r
1143 \r
1144                         if (needType) WriteXsiType("XmlSchemaAppInfo", "http://www.w3.org/2001/XMLSchema");\r
1145 \r
1146                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1147 \r
1148                         WriteAttribute ("source", "", ob.@Source);\r
1149 \r
1150                         if (ob.@Markup != null) {\r
1151                                 foreach (XmlNode o51 in ob.@Markup) {\r
1152                                         XmlNode o52 = o51;
1153                                         if (o52 is XmlElement) {\r
1154                                                 WriteElementLiteral (o52, "", "", false, true);
1155                                         } else o52.WriteTo (Writer);\r
1156                                 }\r
1157                         }\r
1158                         if (writeWrappingElem) WriteEndElement (ob);\r
1159                 }\r
1160 \r
1161                 void WriteObject_XmlSchemaDocumentation (System.Xml.Schema.XmlSchemaDocumentation ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1162                 {\r
1163                         if (ob == null)\r
1164                         {\r
1165                                 if (isNullable)\r
1166                                         WriteNullTagLiteral(element, namesp);\r
1167                                 return;\r
1168                         }\r
1169 \r
1170                         System.Type type = ob.GetType ();\r
1171                         if (type == typeof(System.Xml.Schema.XmlSchemaDocumentation))\r
1172                                 ;\r
1173                         else {\r
1174                                 throw CreateUnknownTypeException (ob);\r
1175                         }\r
1176 \r
1177                         if (writeWrappingElem) {\r
1178                                 WriteStartElement (element, namesp, ob);\r
1179                         }\r
1180 \r
1181                         if (needType) WriteXsiType("XmlSchemaDocumentation", "http://www.w3.org/2001/XMLSchema");\r
1182 \r
1183                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1184 \r
1185                         WriteAttribute ("source", "", ob.@Source);\r
1186                         WriteAttribute ("xml:lang", "", ob.@Language);\r
1187 \r
1188                         if (ob.@Markup != null) {\r
1189                                 foreach (XmlNode o53 in ob.@Markup) {\r
1190                                         XmlNode o54 = o53;
1191                                         if (o54 is XmlElement) {\r
1192                                                 WriteElementLiteral (o54, "", "", false, true);
1193                                         } else o54.WriteTo (Writer);\r
1194                                 }\r
1195                         }\r
1196                         if (writeWrappingElem) WriteEndElement (ob);\r
1197                 }\r
1198 \r
1199                 void WriteObject_XmlSchemaAttributeGroupRef (System.Xml.Schema.XmlSchemaAttributeGroupRef ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1200                 {\r
1201                         if (ob == null)\r
1202                         {\r
1203                                 if (isNullable)\r
1204                                         WriteNullTagLiteral(element, namesp);\r
1205                                 return;\r
1206                         }\r
1207 \r
1208                         System.Type type = ob.GetType ();\r
1209                         if (type == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef))\r
1210                                 ;\r
1211                         else {\r
1212                                 throw CreateUnknownTypeException (ob);\r
1213                         }\r
1214 \r
1215                         if (writeWrappingElem) {\r
1216                                 WriteStartElement (element, namesp, ob);\r
1217                         }\r
1218 \r
1219                         if (needType) WriteXsiType("XmlSchemaAttributeGroupRef", "http://www.w3.org/2001/XMLSchema");\r
1220 \r
1221                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1222 \r
1223                         ICollection o55 = ob.@UnhandledAttributes;\r
1224                         if (o55 != null) {\r
1225                                 foreach (XmlAttribute o56 in o55)\r
1226                                         if (o56.NamespaceURI != xmlNamespace)\r
1227                                                 WriteXmlAttribute (o56, ob);\r
1228                         }\r
1229 \r
1230                         WriteAttribute ("id", "", ob.@Id);\r
1231                         WriteAttribute ("ref", "", FromXmlQualifiedName (ob.@RefName));\r
1232 \r
1233                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1234                         if (writeWrappingElem) WriteEndElement (ob);\r
1235                 }\r
1236 \r
1237                 void WriteObject_XmlSchemaAnyAttribute (System.Xml.Schema.XmlSchemaAnyAttribute ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1238                 {\r
1239                         if (ob == null)\r
1240                         {\r
1241                                 if (isNullable)\r
1242                                         WriteNullTagLiteral(element, namesp);\r
1243                                 return;\r
1244                         }\r
1245 \r
1246                         System.Type type = ob.GetType ();\r
1247                         if (type == typeof(System.Xml.Schema.XmlSchemaAnyAttribute))\r
1248                                 ;\r
1249                         else {\r
1250                                 throw CreateUnknownTypeException (ob);\r
1251                         }\r
1252 \r
1253                         if (writeWrappingElem) {\r
1254                                 WriteStartElement (element, namesp, ob);\r
1255                         }\r
1256 \r
1257                         if (needType) WriteXsiType("XmlSchemaAnyAttribute", "http://www.w3.org/2001/XMLSchema");\r
1258 \r
1259                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1260 \r
1261                         ICollection o57 = ob.@UnhandledAttributes;\r
1262                         if (o57 != null) {\r
1263                                 foreach (XmlAttribute o58 in o57)\r
1264                                         if (o58.NamespaceURI != xmlNamespace)\r
1265                                                 WriteXmlAttribute (o58, ob);\r
1266                         }\r
1267 \r
1268                         WriteAttribute ("id", "", ob.@Id);\r
1269                         WriteAttribute ("namespace", "", ob.@Namespace);\r
1270                         if (ob.@ProcessContents != ((System.Xml.Schema.XmlSchemaContentProcessing) System.Xml.Schema.XmlSchemaContentProcessing.None)) {\r
1271                                 WriteAttribute ("processContents", "", GetEnumValue_XmlSchemaContentProcessing (ob.@ProcessContents));\r
1272                         }\r
1273 \r
1274                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1275                         if (writeWrappingElem) WriteEndElement (ob);\r
1276                 }\r
1277 \r
1278                 void WriteObject_XmlSchemaSequence (System.Xml.Schema.XmlSchemaSequence ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1279                 {\r
1280                         if (ob == null)\r
1281                         {\r
1282                                 if (isNullable)\r
1283                                         WriteNullTagLiteral(element, namesp);\r
1284                                 return;\r
1285                         }\r
1286 \r
1287                         System.Type type = ob.GetType ();\r
1288                         if (type == typeof(System.Xml.Schema.XmlSchemaSequence))\r
1289                                 ;\r
1290                         else {\r
1291                                 throw CreateUnknownTypeException (ob);\r
1292                         }\r
1293 \r
1294                         if (writeWrappingElem) {\r
1295                                 WriteStartElement (element, namesp, ob);\r
1296                         }\r
1297 \r
1298                         if (needType) WriteXsiType("XmlSchemaSequence", "http://www.w3.org/2001/XMLSchema");\r
1299 \r
1300                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1301 \r
1302                         ICollection o59 = ob.@UnhandledAttributes;\r
1303                         if (o59 != null) {\r
1304                                 foreach (XmlAttribute o60 in o59)\r
1305                                         if (o60.NamespaceURI != xmlNamespace)\r
1306                                                 WriteXmlAttribute (o60, ob);\r
1307                         }\r
1308 \r
1309                         WriteAttribute ("id", "", ob.@Id);\r
1310                         WriteAttribute ("minOccurs", "", ob.@MinOccursString);\r
1311                         WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);\r
1312 \r
1313                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1314                         if (ob.@Items != null) {\r
1315                                 for (int n61 = 0; n61 < ob.@Items.Count; n61++) {\r
1316                                         if (ob.@Items[n61] == null) { }\r
1317                                         else if (ob.@Items[n61].GetType() == typeof(System.Xml.Schema.XmlSchemaSequence)) {\r
1318                                                 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Items[n61]), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1319                                         }\r
1320                                         else if (ob.@Items[n61].GetType() == typeof(System.Xml.Schema.XmlSchemaChoice)) {\r
1321                                                 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Items[n61]), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1322                                         }\r
1323                                         else if (ob.@Items[n61].GetType() == typeof(System.Xml.Schema.XmlSchemaGroupRef)) {\r
1324                                                 WriteObject_XmlSchemaGroupRef (((System.Xml.Schema.XmlSchemaGroupRef) ob.@Items[n61]), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1325                                         }\r
1326                                         else if (ob.@Items[n61].GetType() == typeof(System.Xml.Schema.XmlSchemaElement)) {\r
1327                                                 WriteObject_XmlSchemaElement (((System.Xml.Schema.XmlSchemaElement) ob.@Items[n61]), "element", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1328                                         }\r
1329                                         else if (ob.@Items[n61].GetType() == typeof(System.Xml.Schema.XmlSchemaAny)) {\r
1330                                                 WriteObject_XmlSchemaAny (((System.Xml.Schema.XmlSchemaAny) ob.@Items[n61]), "any", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1331                                         }\r
1332                                         else throw CreateUnknownTypeException (ob.@Items[n61]);\r
1333                                 }\r
1334                         }\r
1335                         if (writeWrappingElem) WriteEndElement (ob);\r
1336                 }\r
1337 \r
1338                 void WriteObject_XmlSchemaChoice (System.Xml.Schema.XmlSchemaChoice ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1339                 {\r
1340                         if (ob == null)\r
1341                         {\r
1342                                 if (isNullable)\r
1343                                         WriteNullTagLiteral(element, namesp);\r
1344                                 return;\r
1345                         }\r
1346 \r
1347                         System.Type type = ob.GetType ();\r
1348                         if (type == typeof(System.Xml.Schema.XmlSchemaChoice))\r
1349                                 ;\r
1350                         else {\r
1351                                 throw CreateUnknownTypeException (ob);\r
1352                         }\r
1353 \r
1354                         if (writeWrappingElem) {\r
1355                                 WriteStartElement (element, namesp, ob);\r
1356                         }\r
1357 \r
1358                         if (needType) WriteXsiType("XmlSchemaChoice", "http://www.w3.org/2001/XMLSchema");\r
1359 \r
1360                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1361 \r
1362                         ICollection o62 = ob.@UnhandledAttributes;\r
1363                         if (o62 != null) {\r
1364                                 foreach (XmlAttribute o63 in o62)\r
1365                                         if (o63.NamespaceURI != xmlNamespace)\r
1366                                                 WriteXmlAttribute (o63, ob);\r
1367                         }\r
1368 \r
1369                         WriteAttribute ("id", "", ob.@Id);\r
1370                         WriteAttribute ("minOccurs", "", ob.@MinOccursString);\r
1371                         WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);\r
1372 \r
1373                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1374                         if (ob.@Items != null) {\r
1375                                 for (int n64 = 0; n64 < ob.@Items.Count; n64++) {\r
1376                                         if (ob.@Items[n64] == null) { }\r
1377                                         else if (ob.@Items[n64].GetType() == typeof(System.Xml.Schema.XmlSchemaGroupRef)) {\r
1378                                                 WriteObject_XmlSchemaGroupRef (((System.Xml.Schema.XmlSchemaGroupRef) ob.@Items[n64]), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1379                                         }\r
1380                                         else if (ob.@Items[n64].GetType() == typeof(System.Xml.Schema.XmlSchemaElement)) {\r
1381                                                 WriteObject_XmlSchemaElement (((System.Xml.Schema.XmlSchemaElement) ob.@Items[n64]), "element", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1382                                         }\r
1383                                         else if (ob.@Items[n64].GetType() == typeof(System.Xml.Schema.XmlSchemaAny)) {\r
1384                                                 WriteObject_XmlSchemaAny (((System.Xml.Schema.XmlSchemaAny) ob.@Items[n64]), "any", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1385                                         }\r
1386                                         else if (ob.@Items[n64].GetType() == typeof(System.Xml.Schema.XmlSchemaSequence)) {\r
1387                                                 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Items[n64]), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1388                                         }\r
1389                                         else if (ob.@Items[n64].GetType() == typeof(System.Xml.Schema.XmlSchemaChoice)) {\r
1390                                                 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Items[n64]), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1391                                         }\r
1392                                         else throw CreateUnknownTypeException (ob.@Items[n64]);\r
1393                                 }\r
1394                         }\r
1395                         if (writeWrappingElem) WriteEndElement (ob);\r
1396                 }\r
1397 \r
1398                 void WriteObject_XmlSchemaAll (System.Xml.Schema.XmlSchemaAll ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1399                 {\r
1400                         if (ob == null)\r
1401                         {\r
1402                                 if (isNullable)\r
1403                                         WriteNullTagLiteral(element, namesp);\r
1404                                 return;\r
1405                         }\r
1406 \r
1407                         System.Type type = ob.GetType ();\r
1408                         if (type == typeof(System.Xml.Schema.XmlSchemaAll))\r
1409                                 ;\r
1410                         else {\r
1411                                 throw CreateUnknownTypeException (ob);\r
1412                         }\r
1413 \r
1414                         if (writeWrappingElem) {\r
1415                                 WriteStartElement (element, namesp, ob);\r
1416                         }\r
1417 \r
1418                         if (needType) WriteXsiType("XmlSchemaAll", "http://www.w3.org/2001/XMLSchema");\r
1419 \r
1420                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1421 \r
1422                         ICollection o65 = ob.@UnhandledAttributes;\r
1423                         if (o65 != null) {\r
1424                                 foreach (XmlAttribute o66 in o65)\r
1425                                         if (o66.NamespaceURI != xmlNamespace)\r
1426                                                 WriteXmlAttribute (o66, ob);\r
1427                         }\r
1428 \r
1429                         WriteAttribute ("id", "", ob.@Id);\r
1430                         WriteAttribute ("minOccurs", "", ob.@MinOccursString);\r
1431                         WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);\r
1432 \r
1433                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1434                         if (ob.@Items != null) {\r
1435                                 for (int n67 = 0; n67 < ob.@Items.Count; n67++) {\r
1436                                         WriteObject_XmlSchemaElement (((System.Xml.Schema.XmlSchemaElement) ob.@Items[n67]), "element", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1437                                 }\r
1438                         }\r
1439                         if (writeWrappingElem) WriteEndElement (ob);\r
1440                 }\r
1441 \r
1442                 void WriteObject_XmlSchemaComplexContent (System.Xml.Schema.XmlSchemaComplexContent ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1443                 {\r
1444                         if (ob == null)\r
1445                         {\r
1446                                 if (isNullable)\r
1447                                         WriteNullTagLiteral(element, namesp);\r
1448                                 return;\r
1449                         }\r
1450 \r
1451                         System.Type type = ob.GetType ();\r
1452                         if (type == typeof(System.Xml.Schema.XmlSchemaComplexContent))\r
1453                                 ;\r
1454                         else {\r
1455                                 throw CreateUnknownTypeException (ob);\r
1456                         }\r
1457 \r
1458                         if (writeWrappingElem) {\r
1459                                 WriteStartElement (element, namesp, ob);\r
1460                         }\r
1461 \r
1462                         if (needType) WriteXsiType("XmlSchemaComplexContent", "http://www.w3.org/2001/XMLSchema");\r
1463 \r
1464                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1465 \r
1466                         ICollection o68 = ob.@UnhandledAttributes;\r
1467                         if (o68 != null) {\r
1468                                 foreach (XmlAttribute o69 in o68)\r
1469                                         if (o69.NamespaceURI != xmlNamespace)\r
1470                                                 WriteXmlAttribute (o69, ob);\r
1471                         }\r
1472 \r
1473                         WriteAttribute ("id", "", ob.@Id);\r
1474                         WriteAttribute ("mixed", "", (ob.@IsMixed?"true":"false"));\r
1475 \r
1476                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1477                         if (ob.@Content is System.Xml.Schema.XmlSchemaComplexContentExtension) {\r
1478                                 WriteObject_XmlSchemaComplexContentExtension (((System.Xml.Schema.XmlSchemaComplexContentExtension) ob.@Content), "extension", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1479                         }\r
1480                         else if (ob.@Content is System.Xml.Schema.XmlSchemaComplexContentRestriction) {\r
1481                                 WriteObject_XmlSchemaComplexContentRestriction (((System.Xml.Schema.XmlSchemaComplexContentRestriction) ob.@Content), "restriction", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1482                         }\r
1483                         if (writeWrappingElem) WriteEndElement (ob);\r
1484                 }\r
1485 \r
1486                 void WriteObject_XmlSchemaSimpleContent (System.Xml.Schema.XmlSchemaSimpleContent ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1487                 {\r
1488                         if (ob == null)\r
1489                         {\r
1490                                 if (isNullable)\r
1491                                         WriteNullTagLiteral(element, namesp);\r
1492                                 return;\r
1493                         }\r
1494 \r
1495                         System.Type type = ob.GetType ();\r
1496                         if (type == typeof(System.Xml.Schema.XmlSchemaSimpleContent))\r
1497                                 ;\r
1498                         else {\r
1499                                 throw CreateUnknownTypeException (ob);\r
1500                         }\r
1501 \r
1502                         if (writeWrappingElem) {\r
1503                                 WriteStartElement (element, namesp, ob);\r
1504                         }\r
1505 \r
1506                         if (needType) WriteXsiType("XmlSchemaSimpleContent", "http://www.w3.org/2001/XMLSchema");\r
1507 \r
1508                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1509 \r
1510                         ICollection o70 = ob.@UnhandledAttributes;\r
1511                         if (o70 != null) {\r
1512                                 foreach (XmlAttribute o71 in o70)\r
1513                                         if (o71.NamespaceURI != xmlNamespace)\r
1514                                                 WriteXmlAttribute (o71, ob);\r
1515                         }\r
1516 \r
1517                         WriteAttribute ("id", "", ob.@Id);\r
1518 \r
1519                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1520                         if (ob.@Content is System.Xml.Schema.XmlSchemaSimpleContentExtension) {\r
1521                                 WriteObject_XmlSchemaSimpleContentExtension (((System.Xml.Schema.XmlSchemaSimpleContentExtension) ob.@Content), "extension", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1522                         }\r
1523                         else if (ob.@Content is System.Xml.Schema.XmlSchemaSimpleContentRestriction) {\r
1524                                 WriteObject_XmlSchemaSimpleContentRestriction (((System.Xml.Schema.XmlSchemaSimpleContentRestriction) ob.@Content), "restriction", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1525                         }\r
1526                         if (writeWrappingElem) WriteEndElement (ob);\r
1527                 }\r
1528 \r
1529                 void WriteObject_XmlSchemaGroupRef (System.Xml.Schema.XmlSchemaGroupRef ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1530                 {\r
1531                         if (ob == null)\r
1532                         {\r
1533                                 if (isNullable)\r
1534                                         WriteNullTagLiteral(element, namesp);\r
1535                                 return;\r
1536                         }\r
1537 \r
1538                         System.Type type = ob.GetType ();\r
1539                         if (type == typeof(System.Xml.Schema.XmlSchemaGroupRef))\r
1540                                 ;\r
1541                         else {\r
1542                                 throw CreateUnknownTypeException (ob);\r
1543                         }\r
1544 \r
1545                         if (writeWrappingElem) {\r
1546                                 WriteStartElement (element, namesp, ob);\r
1547                         }\r
1548 \r
1549                         if (needType) WriteXsiType("XmlSchemaGroupRef", "http://www.w3.org/2001/XMLSchema");\r
1550 \r
1551                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1552 \r
1553                         ICollection o72 = ob.@UnhandledAttributes;\r
1554                         if (o72 != null) {\r
1555                                 foreach (XmlAttribute o73 in o72)\r
1556                                         if (o73.NamespaceURI != xmlNamespace)\r
1557                                                 WriteXmlAttribute (o73, ob);\r
1558                         }\r
1559 \r
1560                         WriteAttribute ("id", "", ob.@Id);\r
1561                         WriteAttribute ("minOccurs", "", ob.@MinOccursString);\r
1562                         WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);\r
1563                         WriteAttribute ("ref", "", FromXmlQualifiedName (ob.@RefName));\r
1564 \r
1565                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1566                         if (writeWrappingElem) WriteEndElement (ob);\r
1567                 }\r
1568 \r
1569                 void WriteObject_XmlSchemaXPath (System.Xml.Schema.XmlSchemaXPath ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1570                 {\r
1571                         if (ob == null)\r
1572                         {\r
1573                                 if (isNullable)\r
1574                                         WriteNullTagLiteral(element, namesp);\r
1575                                 return;\r
1576                         }\r
1577 \r
1578                         System.Type type = ob.GetType ();\r
1579                         if (type == typeof(System.Xml.Schema.XmlSchemaXPath))\r
1580                                 ;\r
1581                         else {\r
1582                                 throw CreateUnknownTypeException (ob);\r
1583                         }\r
1584 \r
1585                         if (writeWrappingElem) {\r
1586                                 WriteStartElement (element, namesp, ob);\r
1587                         }\r
1588 \r
1589                         if (needType) WriteXsiType("XmlSchemaXPath", "http://www.w3.org/2001/XMLSchema");\r
1590 \r
1591                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1592 \r
1593                         ICollection o74 = ob.@UnhandledAttributes;\r
1594                         if (o74 != null) {\r
1595                                 foreach (XmlAttribute o75 in o74)\r
1596                                         if (o75.NamespaceURI != xmlNamespace)\r
1597                                                 WriteXmlAttribute (o75, ob);\r
1598                         }\r
1599 \r
1600                         WriteAttribute ("id", "", ob.@Id);\r
1601                         if (ob.@XPath != null) {\r
1602                                 WriteAttribute ("xpath", "", ob.@XPath);\r
1603                         }\r
1604 \r
1605                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1606                         if (writeWrappingElem) WriteEndElement (ob);\r
1607                 }\r
1608 \r
1609                 void WriteObject_XmlSchemaMaxLengthFacet (System.Xml.Schema.XmlSchemaMaxLengthFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1610                 {\r
1611                         if (ob == null)\r
1612                         {\r
1613                                 if (isNullable)\r
1614                                         WriteNullTagLiteral(element, namesp);\r
1615                                 return;\r
1616                         }\r
1617 \r
1618                         System.Type type = ob.GetType ();\r
1619                         if (type == typeof(System.Xml.Schema.XmlSchemaMaxLengthFacet))\r
1620                                 ;\r
1621                         else {\r
1622                                 throw CreateUnknownTypeException (ob);\r
1623                         }\r
1624 \r
1625                         if (writeWrappingElem) {\r
1626                                 WriteStartElement (element, namesp, ob);\r
1627                         }\r
1628 \r
1629                         if (needType) WriteXsiType("XmlSchemaMaxLengthFacet", "http://www.w3.org/2001/XMLSchema");\r
1630 \r
1631                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1632 \r
1633                         ICollection o76 = ob.@UnhandledAttributes;\r
1634                         if (o76 != null) {\r
1635                                 foreach (XmlAttribute o77 in o76)\r
1636                                         if (o77.NamespaceURI != xmlNamespace)\r
1637                                                 WriteXmlAttribute (o77, ob);\r
1638                         }\r
1639 \r
1640                         WriteAttribute ("id", "", ob.@Id);\r
1641                         WriteAttribute ("value", "", ob.@Value);\r
1642                         if (ob.@IsFixed != false) {\r
1643                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
1644                         }\r
1645 \r
1646                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1647                         if (writeWrappingElem) WriteEndElement (ob);\r
1648                 }\r
1649 \r
1650                 void WriteObject_XmlSchemaMinLengthFacet (System.Xml.Schema.XmlSchemaMinLengthFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1651                 {\r
1652                         if (ob == null)\r
1653                         {\r
1654                                 if (isNullable)\r
1655                                         WriteNullTagLiteral(element, namesp);\r
1656                                 return;\r
1657                         }\r
1658 \r
1659                         System.Type type = ob.GetType ();\r
1660                         if (type == typeof(System.Xml.Schema.XmlSchemaMinLengthFacet))\r
1661                                 ;\r
1662                         else {\r
1663                                 throw CreateUnknownTypeException (ob);\r
1664                         }\r
1665 \r
1666                         if (writeWrappingElem) {\r
1667                                 WriteStartElement (element, namesp, ob);\r
1668                         }\r
1669 \r
1670                         if (needType) WriteXsiType("XmlSchemaMinLengthFacet", "http://www.w3.org/2001/XMLSchema");\r
1671 \r
1672                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1673 \r
1674                         ICollection o78 = ob.@UnhandledAttributes;\r
1675                         if (o78 != null) {\r
1676                                 foreach (XmlAttribute o79 in o78)\r
1677                                         if (o79.NamespaceURI != xmlNamespace)\r
1678                                                 WriteXmlAttribute (o79, ob);\r
1679                         }\r
1680 \r
1681                         WriteAttribute ("id", "", ob.@Id);\r
1682                         WriteAttribute ("value", "", ob.@Value);\r
1683                         if (ob.@IsFixed != false) {\r
1684                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
1685                         }\r
1686 \r
1687                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1688                         if (writeWrappingElem) WriteEndElement (ob);\r
1689                 }\r
1690 \r
1691                 void WriteObject_XmlSchemaLengthFacet (System.Xml.Schema.XmlSchemaLengthFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1692                 {\r
1693                         if (ob == null)\r
1694                         {\r
1695                                 if (isNullable)\r
1696                                         WriteNullTagLiteral(element, namesp);\r
1697                                 return;\r
1698                         }\r
1699 \r
1700                         System.Type type = ob.GetType ();\r
1701                         if (type == typeof(System.Xml.Schema.XmlSchemaLengthFacet))\r
1702                                 ;\r
1703                         else {\r
1704                                 throw CreateUnknownTypeException (ob);\r
1705                         }\r
1706 \r
1707                         if (writeWrappingElem) {\r
1708                                 WriteStartElement (element, namesp, ob);\r
1709                         }\r
1710 \r
1711                         if (needType) WriteXsiType("XmlSchemaLengthFacet", "http://www.w3.org/2001/XMLSchema");\r
1712 \r
1713                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1714 \r
1715                         ICollection o80 = ob.@UnhandledAttributes;\r
1716                         if (o80 != null) {\r
1717                                 foreach (XmlAttribute o81 in o80)\r
1718                                         if (o81.NamespaceURI != xmlNamespace)\r
1719                                                 WriteXmlAttribute (o81, ob);\r
1720                         }\r
1721 \r
1722                         WriteAttribute ("id", "", ob.@Id);\r
1723                         WriteAttribute ("value", "", ob.@Value);\r
1724                         if (ob.@IsFixed != false) {\r
1725                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
1726                         }\r
1727 \r
1728                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1729                         if (writeWrappingElem) WriteEndElement (ob);\r
1730                 }\r
1731 \r
1732                 void WriteObject_XmlSchemaFractionDigitsFacet (System.Xml.Schema.XmlSchemaFractionDigitsFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1733                 {\r
1734                         if (ob == null)\r
1735                         {\r
1736                                 if (isNullable)\r
1737                                         WriteNullTagLiteral(element, namesp);\r
1738                                 return;\r
1739                         }\r
1740 \r
1741                         System.Type type = ob.GetType ();\r
1742                         if (type == typeof(System.Xml.Schema.XmlSchemaFractionDigitsFacet))\r
1743                                 ;\r
1744                         else {\r
1745                                 throw CreateUnknownTypeException (ob);\r
1746                         }\r
1747 \r
1748                         if (writeWrappingElem) {\r
1749                                 WriteStartElement (element, namesp, ob);\r
1750                         }\r
1751 \r
1752                         if (needType) WriteXsiType("XmlSchemaFractionDigitsFacet", "http://www.w3.org/2001/XMLSchema");\r
1753 \r
1754                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1755 \r
1756                         ICollection o82 = ob.@UnhandledAttributes;\r
1757                         if (o82 != null) {\r
1758                                 foreach (XmlAttribute o83 in o82)\r
1759                                         if (o83.NamespaceURI != xmlNamespace)\r
1760                                                 WriteXmlAttribute (o83, ob);\r
1761                         }\r
1762 \r
1763                         WriteAttribute ("id", "", ob.@Id);\r
1764                         WriteAttribute ("value", "", ob.@Value);\r
1765                         if (ob.@IsFixed != false) {\r
1766                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
1767                         }\r
1768 \r
1769                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1770                         if (writeWrappingElem) WriteEndElement (ob);\r
1771                 }\r
1772 \r
1773                 void WriteObject_XmlSchemaMaxInclusiveFacet (System.Xml.Schema.XmlSchemaMaxInclusiveFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1774                 {\r
1775                         if (ob == null)\r
1776                         {\r
1777                                 if (isNullable)\r
1778                                         WriteNullTagLiteral(element, namesp);\r
1779                                 return;\r
1780                         }\r
1781 \r
1782                         System.Type type = ob.GetType ();\r
1783                         if (type == typeof(System.Xml.Schema.XmlSchemaMaxInclusiveFacet))\r
1784                                 ;\r
1785                         else {\r
1786                                 throw CreateUnknownTypeException (ob);\r
1787                         }\r
1788 \r
1789                         if (writeWrappingElem) {\r
1790                                 WriteStartElement (element, namesp, ob);\r
1791                         }\r
1792 \r
1793                         if (needType) WriteXsiType("XmlSchemaMaxInclusiveFacet", "http://www.w3.org/2001/XMLSchema");\r
1794 \r
1795                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1796 \r
1797                         ICollection o84 = ob.@UnhandledAttributes;\r
1798                         if (o84 != null) {\r
1799                                 foreach (XmlAttribute o85 in o84)\r
1800                                         if (o85.NamespaceURI != xmlNamespace)\r
1801                                                 WriteXmlAttribute (o85, ob);\r
1802                         }\r
1803 \r
1804                         WriteAttribute ("id", "", ob.@Id);\r
1805                         WriteAttribute ("value", "", ob.@Value);\r
1806                         if (ob.@IsFixed != false) {\r
1807                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
1808                         }\r
1809 \r
1810                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1811                         if (writeWrappingElem) WriteEndElement (ob);\r
1812                 }\r
1813 \r
1814                 void WriteObject_XmlSchemaMaxExclusiveFacet (System.Xml.Schema.XmlSchemaMaxExclusiveFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1815                 {\r
1816                         if (ob == null)\r
1817                         {\r
1818                                 if (isNullable)\r
1819                                         WriteNullTagLiteral(element, namesp);\r
1820                                 return;\r
1821                         }\r
1822 \r
1823                         System.Type type = ob.GetType ();\r
1824                         if (type == typeof(System.Xml.Schema.XmlSchemaMaxExclusiveFacet))\r
1825                                 ;\r
1826                         else {\r
1827                                 throw CreateUnknownTypeException (ob);\r
1828                         }\r
1829 \r
1830                         if (writeWrappingElem) {\r
1831                                 WriteStartElement (element, namesp, ob);\r
1832                         }\r
1833 \r
1834                         if (needType) WriteXsiType("XmlSchemaMaxExclusiveFacet", "http://www.w3.org/2001/XMLSchema");\r
1835 \r
1836                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1837 \r
1838                         ICollection o86 = ob.@UnhandledAttributes;\r
1839                         if (o86 != null) {\r
1840                                 foreach (XmlAttribute o87 in o86)\r
1841                                         if (o87.NamespaceURI != xmlNamespace)\r
1842                                                 WriteXmlAttribute (o87, ob);\r
1843                         }\r
1844 \r
1845                         WriteAttribute ("id", "", ob.@Id);\r
1846                         WriteAttribute ("value", "", ob.@Value);\r
1847                         if (ob.@IsFixed != false) {\r
1848                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
1849                         }\r
1850 \r
1851                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1852                         if (writeWrappingElem) WriteEndElement (ob);\r
1853                 }\r
1854 \r
1855                 void WriteObject_XmlSchemaMinExclusiveFacet (System.Xml.Schema.XmlSchemaMinExclusiveFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1856                 {\r
1857                         if (ob == null)\r
1858                         {\r
1859                                 if (isNullable)\r
1860                                         WriteNullTagLiteral(element, namesp);\r
1861                                 return;\r
1862                         }\r
1863 \r
1864                         System.Type type = ob.GetType ();\r
1865                         if (type == typeof(System.Xml.Schema.XmlSchemaMinExclusiveFacet))\r
1866                                 ;\r
1867                         else {\r
1868                                 throw CreateUnknownTypeException (ob);\r
1869                         }\r
1870 \r
1871                         if (writeWrappingElem) {\r
1872                                 WriteStartElement (element, namesp, ob);\r
1873                         }\r
1874 \r
1875                         if (needType) WriteXsiType("XmlSchemaMinExclusiveFacet", "http://www.w3.org/2001/XMLSchema");\r
1876 \r
1877                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1878 \r
1879                         ICollection o88 = ob.@UnhandledAttributes;\r
1880                         if (o88 != null) {\r
1881                                 foreach (XmlAttribute o89 in o88)\r
1882                                         if (o89.NamespaceURI != xmlNamespace)\r
1883                                                 WriteXmlAttribute (o89, ob);\r
1884                         }\r
1885 \r
1886                         WriteAttribute ("id", "", ob.@Id);\r
1887                         WriteAttribute ("value", "", ob.@Value);\r
1888                         if (ob.@IsFixed != false) {\r
1889                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
1890                         }\r
1891 \r
1892                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1893                         if (writeWrappingElem) WriteEndElement (ob);\r
1894                 }\r
1895 \r
1896                 void WriteObject_XmlSchemaEnumerationFacet (System.Xml.Schema.XmlSchemaEnumerationFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1897                 {\r
1898                         if (ob == null)\r
1899                         {\r
1900                                 if (isNullable)\r
1901                                         WriteNullTagLiteral(element, namesp);\r
1902                                 return;\r
1903                         }\r
1904 \r
1905                         System.Type type = ob.GetType ();\r
1906                         if (type == typeof(System.Xml.Schema.XmlSchemaEnumerationFacet))\r
1907                                 ;\r
1908                         else {\r
1909                                 throw CreateUnknownTypeException (ob);\r
1910                         }\r
1911 \r
1912                         if (writeWrappingElem) {\r
1913                                 WriteStartElement (element, namesp, ob);\r
1914                         }\r
1915 \r
1916                         if (needType) WriteXsiType("XmlSchemaEnumerationFacet", "http://www.w3.org/2001/XMLSchema");\r
1917 \r
1918                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1919 \r
1920                         ICollection o90 = ob.@UnhandledAttributes;\r
1921                         if (o90 != null) {\r
1922                                 foreach (XmlAttribute o91 in o90)\r
1923                                         if (o91.NamespaceURI != xmlNamespace)\r
1924                                                 WriteXmlAttribute (o91, ob);\r
1925                         }\r
1926 \r
1927                         WriteAttribute ("id", "", ob.@Id);\r
1928                         WriteAttribute ("value", "", ob.@Value);\r
1929                         if (ob.@IsFixed != false) {\r
1930                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
1931                         }\r
1932 \r
1933                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1934                         if (writeWrappingElem) WriteEndElement (ob);\r
1935                 }\r
1936 \r
1937                 void WriteObject_XmlSchemaTotalDigitsFacet (System.Xml.Schema.XmlSchemaTotalDigitsFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1938                 {\r
1939                         if (ob == null)\r
1940                         {\r
1941                                 if (isNullable)\r
1942                                         WriteNullTagLiteral(element, namesp);\r
1943                                 return;\r
1944                         }\r
1945 \r
1946                         System.Type type = ob.GetType ();\r
1947                         if (type == typeof(System.Xml.Schema.XmlSchemaTotalDigitsFacet))\r
1948                                 ;\r
1949                         else {\r
1950                                 throw CreateUnknownTypeException (ob);\r
1951                         }\r
1952 \r
1953                         if (writeWrappingElem) {\r
1954                                 WriteStartElement (element, namesp, ob);\r
1955                         }\r
1956 \r
1957                         if (needType) WriteXsiType("XmlSchemaTotalDigitsFacet", "http://www.w3.org/2001/XMLSchema");\r
1958 \r
1959                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
1960 \r
1961                         ICollection o92 = ob.@UnhandledAttributes;\r
1962                         if (o92 != null) {\r
1963                                 foreach (XmlAttribute o93 in o92)\r
1964                                         if (o93.NamespaceURI != xmlNamespace)\r
1965                                                 WriteXmlAttribute (o93, ob);\r
1966                         }\r
1967 \r
1968                         WriteAttribute ("id", "", ob.@Id);\r
1969                         WriteAttribute ("value", "", ob.@Value);\r
1970                         if (ob.@IsFixed != false) {\r
1971                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
1972                         }\r
1973 \r
1974                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
1975                         if (writeWrappingElem) WriteEndElement (ob);\r
1976                 }\r
1977 \r
1978                 void WriteObject_XmlSchemaMinInclusiveFacet (System.Xml.Schema.XmlSchemaMinInclusiveFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
1979                 {\r
1980                         if (ob == null)\r
1981                         {\r
1982                                 if (isNullable)\r
1983                                         WriteNullTagLiteral(element, namesp);\r
1984                                 return;\r
1985                         }\r
1986 \r
1987                         System.Type type = ob.GetType ();\r
1988                         if (type == typeof(System.Xml.Schema.XmlSchemaMinInclusiveFacet))\r
1989                                 ;\r
1990                         else {\r
1991                                 throw CreateUnknownTypeException (ob);\r
1992                         }\r
1993 \r
1994                         if (writeWrappingElem) {\r
1995                                 WriteStartElement (element, namesp, ob);\r
1996                         }\r
1997 \r
1998                         if (needType) WriteXsiType("XmlSchemaMinInclusiveFacet", "http://www.w3.org/2001/XMLSchema");\r
1999 \r
2000                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
2001 \r
2002                         ICollection o94 = ob.@UnhandledAttributes;\r
2003                         if (o94 != null) {\r
2004                                 foreach (XmlAttribute o95 in o94)\r
2005                                         if (o95.NamespaceURI != xmlNamespace)\r
2006                                                 WriteXmlAttribute (o95, ob);\r
2007                         }\r
2008 \r
2009                         WriteAttribute ("id", "", ob.@Id);\r
2010                         WriteAttribute ("value", "", ob.@Value);\r
2011                         if (ob.@IsFixed != false) {\r
2012                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
2013                         }\r
2014 \r
2015                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2016                         if (writeWrappingElem) WriteEndElement (ob);\r
2017                 }\r
2018 \r
2019                 void WriteObject_XmlSchemaWhiteSpaceFacet (System.Xml.Schema.XmlSchemaWhiteSpaceFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
2020                 {\r
2021                         if (ob == null)\r
2022                         {\r
2023                                 if (isNullable)\r
2024                                         WriteNullTagLiteral(element, namesp);\r
2025                                 return;\r
2026                         }\r
2027 \r
2028                         System.Type type = ob.GetType ();\r
2029                         if (type == typeof(System.Xml.Schema.XmlSchemaWhiteSpaceFacet))\r
2030                                 ;\r
2031                         else {\r
2032                                 throw CreateUnknownTypeException (ob);\r
2033                         }\r
2034 \r
2035                         if (writeWrappingElem) {\r
2036                                 WriteStartElement (element, namesp, ob);\r
2037                         }\r
2038 \r
2039                         if (needType) WriteXsiType("XmlSchemaWhiteSpaceFacet", "http://www.w3.org/2001/XMLSchema");\r
2040 \r
2041                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
2042 \r
2043                         ICollection o96 = ob.@UnhandledAttributes;\r
2044                         if (o96 != null) {\r
2045                                 foreach (XmlAttribute o97 in o96)\r
2046                                         if (o97.NamespaceURI != xmlNamespace)\r
2047                                                 WriteXmlAttribute (o97, ob);\r
2048                         }\r
2049 \r
2050                         WriteAttribute ("id", "", ob.@Id);\r
2051                         WriteAttribute ("value", "", ob.@Value);\r
2052                         if (ob.@IsFixed != false) {\r
2053                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
2054                         }\r
2055 \r
2056                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2057                         if (writeWrappingElem) WriteEndElement (ob);\r
2058                 }\r
2059 \r
2060                 void WriteObject_XmlSchemaPatternFacet (System.Xml.Schema.XmlSchemaPatternFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
2061                 {\r
2062                         if (ob == null)\r
2063                         {\r
2064                                 if (isNullable)\r
2065                                         WriteNullTagLiteral(element, namesp);\r
2066                                 return;\r
2067                         }\r
2068 \r
2069                         System.Type type = ob.GetType ();\r
2070                         if (type == typeof(System.Xml.Schema.XmlSchemaPatternFacet))\r
2071                                 ;\r
2072                         else {\r
2073                                 throw CreateUnknownTypeException (ob);\r
2074                         }\r
2075 \r
2076                         if (writeWrappingElem) {\r
2077                                 WriteStartElement (element, namesp, ob);\r
2078                         }\r
2079 \r
2080                         if (needType) WriteXsiType("XmlSchemaPatternFacet", "http://www.w3.org/2001/XMLSchema");\r
2081 \r
2082                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
2083 \r
2084                         ICollection o98 = ob.@UnhandledAttributes;\r
2085                         if (o98 != null) {\r
2086                                 foreach (XmlAttribute o99 in o98)\r
2087                                         if (o99.NamespaceURI != xmlNamespace)\r
2088                                                 WriteXmlAttribute (o99, ob);\r
2089                         }\r
2090 \r
2091                         WriteAttribute ("id", "", ob.@Id);\r
2092                         WriteAttribute ("value", "", ob.@Value);\r
2093                         if (ob.@IsFixed != false) {\r
2094                                 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));\r
2095                         }\r
2096 \r
2097                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2098                         if (writeWrappingElem) WriteEndElement (ob);\r
2099                 }\r
2100 \r
2101                 void WriteObject_XmlSchemaContentProcessing (System.Xml.Schema.XmlSchemaContentProcessing ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
2102                 {\r
2103                         System.Type type = ob.GetType ();\r
2104                         if (type == typeof(System.Xml.Schema.XmlSchemaContentProcessing))\r
2105                                 ;\r
2106                         else {\r
2107                                 throw CreateUnknownTypeException (ob);\r
2108                         }\r
2109 \r
2110                         if (writeWrappingElem) {\r
2111                                 WriteStartElement (element, namesp, ob);\r
2112                         }\r
2113 \r
2114                         if (needType) WriteXsiType("XmlSchemaContentProcessing", "");\r
2115 \r
2116                         Writer.WriteString (GetEnumValue_XmlSchemaContentProcessing (ob));\r
2117                         if (writeWrappingElem) WriteEndElement (ob);\r
2118                 }\r
2119 \r
2120                 string GetEnumValue_XmlSchemaContentProcessing (System.Xml.Schema.XmlSchemaContentProcessing val)\r
2121                 {\r
2122                         switch (val)\r
2123                         {\r
2124                                 case System.Xml.Schema.XmlSchemaContentProcessing.Skip: return "skip";\r
2125                                 case System.Xml.Schema.XmlSchemaContentProcessing.Lax: return "lax";\r
2126                                 case System.Xml.Schema.XmlSchemaContentProcessing.Strict: return "strict";\r
2127                                 default: return ((long)val).ToString(CultureInfo.InvariantCulture);\r
2128                         }\r
2129                 }\r
2130 \r
2131                 void WriteObject_XmlSchemaAny (System.Xml.Schema.XmlSchemaAny ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
2132                 {\r
2133                         if (ob == null)\r
2134                         {\r
2135                                 if (isNullable)\r
2136                                         WriteNullTagLiteral(element, namesp);\r
2137                                 return;\r
2138                         }\r
2139 \r
2140                         System.Type type = ob.GetType ();\r
2141                         if (type == typeof(System.Xml.Schema.XmlSchemaAny))\r
2142                                 ;\r
2143                         else {\r
2144                                 throw CreateUnknownTypeException (ob);\r
2145                         }\r
2146 \r
2147                         if (writeWrappingElem) {\r
2148                                 WriteStartElement (element, namesp, ob);\r
2149                         }\r
2150 \r
2151                         if (needType) WriteXsiType("XmlSchemaAny", "http://www.w3.org/2001/XMLSchema");\r
2152 \r
2153                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
2154 \r
2155                         ICollection o100 = ob.@UnhandledAttributes;\r
2156                         if (o100 != null) {\r
2157                                 foreach (XmlAttribute o101 in o100)\r
2158                                         if (o101.NamespaceURI != xmlNamespace)\r
2159                                                 WriteXmlAttribute (o101, ob);\r
2160                         }\r
2161 \r
2162                         WriteAttribute ("id", "", ob.@Id);\r
2163                         WriteAttribute ("minOccurs", "", ob.@MinOccursString);\r
2164                         WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);\r
2165                         WriteAttribute ("namespace", "", ob.@Namespace);\r
2166                         if (ob.@ProcessContents != ((System.Xml.Schema.XmlSchemaContentProcessing) System.Xml.Schema.XmlSchemaContentProcessing.None)) {\r
2167                                 WriteAttribute ("processContents", "", GetEnumValue_XmlSchemaContentProcessing (ob.@ProcessContents));\r
2168                         }\r
2169 \r
2170                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2171                         if (writeWrappingElem) WriteEndElement (ob);\r
2172                 }\r
2173 \r
2174                 void WriteObject_XmlSchemaComplexContentExtension (System.Xml.Schema.XmlSchemaComplexContentExtension ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
2175                 {\r
2176                         if (ob == null)\r
2177                         {\r
2178                                 if (isNullable)\r
2179                                         WriteNullTagLiteral(element, namesp);\r
2180                                 return;\r
2181                         }\r
2182 \r
2183                         System.Type type = ob.GetType ();\r
2184                         if (type == typeof(System.Xml.Schema.XmlSchemaComplexContentExtension))\r
2185                                 ;\r
2186                         else {\r
2187                                 throw CreateUnknownTypeException (ob);\r
2188                         }\r
2189 \r
2190                         if (writeWrappingElem) {\r
2191                                 WriteStartElement (element, namesp, ob);\r
2192                         }\r
2193 \r
2194                         if (needType) WriteXsiType("XmlSchemaComplexContentExtension", "http://www.w3.org/2001/XMLSchema");\r
2195 \r
2196                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
2197 \r
2198                         ICollection o102 = ob.@UnhandledAttributes;\r
2199                         if (o102 != null) {\r
2200                                 foreach (XmlAttribute o103 in o102)\r
2201                                         if (o103.NamespaceURI != xmlNamespace)\r
2202                                                 WriteXmlAttribute (o103, ob);\r
2203                         }\r
2204 \r
2205                         WriteAttribute ("id", "", ob.@Id);\r
2206                         WriteAttribute ("base", "", FromXmlQualifiedName (ob.@BaseTypeName));\r
2207 \r
2208                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2209                         if (ob.@Particle is System.Xml.Schema.XmlSchemaGroupRef) {\r
2210                                 WriteObject_XmlSchemaGroupRef (((System.Xml.Schema.XmlSchemaGroupRef) ob.@Particle), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2211                         }\r
2212                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaSequence) {\r
2213                                 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Particle), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2214                         }\r
2215                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaChoice) {\r
2216                                 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Particle), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2217                         }\r
2218                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaAll) {\r
2219                                 WriteObject_XmlSchemaAll (((System.Xml.Schema.XmlSchemaAll) ob.@Particle), "all", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2220                         }\r
2221                         if (ob.@Attributes != null) {\r
2222                                 for (int n104 = 0; n104 < ob.@Attributes.Count; n104++) {\r
2223                                         if (ob.@Attributes[n104] == null) { }\r
2224                                         else if (ob.@Attributes[n104].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {\r
2225                                                 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n104]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2226                                         }\r
2227                                         else if (ob.@Attributes[n104].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {\r
2228                                                 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n104]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2229                                         }\r
2230                                         else throw CreateUnknownTypeException (ob.@Attributes[n104]);\r
2231                                 }\r
2232                         }\r
2233                         WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2234                         if (writeWrappingElem) WriteEndElement (ob);\r
2235                 }\r
2236 \r
2237                 void WriteObject_XmlSchemaComplexContentRestriction (System.Xml.Schema.XmlSchemaComplexContentRestriction ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
2238                 {\r
2239                         if (ob == null)\r
2240                         {\r
2241                                 if (isNullable)\r
2242                                         WriteNullTagLiteral(element, namesp);\r
2243                                 return;\r
2244                         }\r
2245 \r
2246                         System.Type type = ob.GetType ();\r
2247                         if (type == typeof(System.Xml.Schema.XmlSchemaComplexContentRestriction))\r
2248                                 ;\r
2249                         else {\r
2250                                 throw CreateUnknownTypeException (ob);\r
2251                         }\r
2252 \r
2253                         if (writeWrappingElem) {\r
2254                                 WriteStartElement (element, namesp, ob);\r
2255                         }\r
2256 \r
2257                         if (needType) WriteXsiType("XmlSchemaComplexContentRestriction", "http://www.w3.org/2001/XMLSchema");\r
2258 \r
2259                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
2260 \r
2261                         ICollection o105 = ob.@UnhandledAttributes;\r
2262                         if (o105 != null) {\r
2263                                 foreach (XmlAttribute o106 in o105)\r
2264                                         if (o106.NamespaceURI != xmlNamespace)\r
2265                                                 WriteXmlAttribute (o106, ob);\r
2266                         }\r
2267 \r
2268                         WriteAttribute ("id", "", ob.@Id);\r
2269                         WriteAttribute ("base", "", FromXmlQualifiedName (ob.@BaseTypeName));\r
2270 \r
2271                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2272                         if (ob.@Particle is System.Xml.Schema.XmlSchemaSequence) {\r
2273                                 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Particle), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2274                         }\r
2275                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaChoice) {\r
2276                                 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Particle), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2277                         }\r
2278                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaGroupRef) {\r
2279                                 WriteObject_XmlSchemaGroupRef (((System.Xml.Schema.XmlSchemaGroupRef) ob.@Particle), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2280                         }\r
2281                         else if (ob.@Particle is System.Xml.Schema.XmlSchemaAll) {\r
2282                                 WriteObject_XmlSchemaAll (((System.Xml.Schema.XmlSchemaAll) ob.@Particle), "all", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2283                         }\r
2284                         if (ob.@Attributes != null) {\r
2285                                 for (int n107 = 0; n107 < ob.@Attributes.Count; n107++) {\r
2286                                         if (ob.@Attributes[n107] == null) { }\r
2287                                         else if (ob.@Attributes[n107].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {\r
2288                                                 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n107]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2289                                         }\r
2290                                         else if (ob.@Attributes[n107].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {\r
2291                                                 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n107]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2292                                         }\r
2293                                         else throw CreateUnknownTypeException (ob.@Attributes[n107]);\r
2294                                 }\r
2295                         }\r
2296                         WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2297                         if (writeWrappingElem) WriteEndElement (ob);\r
2298                 }\r
2299 \r
2300                 void WriteObject_XmlSchemaSimpleContentExtension (System.Xml.Schema.XmlSchemaSimpleContentExtension ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
2301                 {\r
2302                         if (ob == null)\r
2303                         {\r
2304                                 if (isNullable)\r
2305                                         WriteNullTagLiteral(element, namesp);\r
2306                                 return;\r
2307                         }\r
2308 \r
2309                         System.Type type = ob.GetType ();\r
2310                         if (type == typeof(System.Xml.Schema.XmlSchemaSimpleContentExtension))\r
2311                                 ;\r
2312                         else {\r
2313                                 throw CreateUnknownTypeException (ob);\r
2314                         }\r
2315 \r
2316                         if (writeWrappingElem) {\r
2317                                 WriteStartElement (element, namesp, ob);\r
2318                         }\r
2319 \r
2320                         if (needType) WriteXsiType("XmlSchemaSimpleContentExtension", "http://www.w3.org/2001/XMLSchema");\r
2321 \r
2322                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
2323 \r
2324                         ICollection o108 = ob.@UnhandledAttributes;\r
2325                         if (o108 != null) {\r
2326                                 foreach (XmlAttribute o109 in o108)\r
2327                                         if (o109.NamespaceURI != xmlNamespace)\r
2328                                                 WriteXmlAttribute (o109, ob);\r
2329                         }\r
2330 \r
2331                         WriteAttribute ("id", "", ob.@Id);\r
2332                         WriteAttribute ("base", "", FromXmlQualifiedName (ob.@BaseTypeName));\r
2333 \r
2334                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2335                         if (ob.@Attributes != null) {\r
2336                                 for (int n110 = 0; n110 < ob.@Attributes.Count; n110++) {\r
2337                                         if (ob.@Attributes[n110] == null) { }\r
2338                                         else if (ob.@Attributes[n110].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {\r
2339                                                 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n110]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2340                                         }\r
2341                                         else if (ob.@Attributes[n110].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {\r
2342                                                 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n110]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2343                                         }\r
2344                                         else throw CreateUnknownTypeException (ob.@Attributes[n110]);\r
2345                                 }\r
2346                         }\r
2347                         WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2348                         if (writeWrappingElem) WriteEndElement (ob);\r
2349                 }\r
2350 \r
2351                 void WriteObject_XmlSchemaSimpleContentRestriction (System.Xml.Schema.XmlSchemaSimpleContentRestriction ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)\r
2352                 {\r
2353                         if (ob == null)\r
2354                         {\r
2355                                 if (isNullable)\r
2356                                         WriteNullTagLiteral(element, namesp);\r
2357                                 return;\r
2358                         }\r
2359 \r
2360                         System.Type type = ob.GetType ();\r
2361                         if (type == typeof(System.Xml.Schema.XmlSchemaSimpleContentRestriction))\r
2362                                 ;\r
2363                         else {\r
2364                                 throw CreateUnknownTypeException (ob);\r
2365                         }\r
2366 \r
2367                         if (writeWrappingElem) {\r
2368                                 WriteStartElement (element, namesp, ob);\r
2369                         }\r
2370 \r
2371                         if (needType) WriteXsiType("XmlSchemaSimpleContentRestriction", "http://www.w3.org/2001/XMLSchema");\r
2372 \r
2373                         WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);\r
2374 \r
2375                         ICollection o111 = ob.@UnhandledAttributes;\r
2376                         if (o111 != null) {\r
2377                                 foreach (XmlAttribute o112 in o111)\r
2378                                         if (o112.NamespaceURI != xmlNamespace)\r
2379                                                 WriteXmlAttribute (o112, ob);\r
2380                         }\r
2381 \r
2382                         WriteAttribute ("id", "", ob.@Id);\r
2383                         WriteAttribute ("base", "", FromXmlQualifiedName (ob.@BaseTypeName));\r
2384 \r
2385                         WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2386                         WriteObject_XmlSchemaSimpleType (ob.@BaseType, "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2387                         if (ob.@Facets != null) {\r
2388                                 for (int n113 = 0; n113 < ob.@Facets.Count; n113++) {\r
2389                                         if (ob.@Facets[n113] == null) { }\r
2390                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaEnumerationFacet)) {\r
2391                                                 WriteObject_XmlSchemaEnumerationFacet (((System.Xml.Schema.XmlSchemaEnumerationFacet) ob.@Facets[n113]), "enumeration", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2392                                         }\r
2393                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxLengthFacet)) {\r
2394                                                 WriteObject_XmlSchemaMaxLengthFacet (((System.Xml.Schema.XmlSchemaMaxLengthFacet) ob.@Facets[n113]), "maxLength", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2395                                         }\r
2396                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMinLengthFacet)) {\r
2397                                                 WriteObject_XmlSchemaMinLengthFacet (((System.Xml.Schema.XmlSchemaMinLengthFacet) ob.@Facets[n113]), "minLength", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2398                                         }\r
2399                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaLengthFacet)) {\r
2400                                                 WriteObject_XmlSchemaLengthFacet (((System.Xml.Schema.XmlSchemaLengthFacet) ob.@Facets[n113]), "length", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2401                                         }\r
2402                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaFractionDigitsFacet)) {\r
2403                                                 WriteObject_XmlSchemaFractionDigitsFacet (((System.Xml.Schema.XmlSchemaFractionDigitsFacet) ob.@Facets[n113]), "fractionDigits", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2404                                         }\r
2405                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaTotalDigitsFacet)) {\r
2406                                                 WriteObject_XmlSchemaTotalDigitsFacet (((System.Xml.Schema.XmlSchemaTotalDigitsFacet) ob.@Facets[n113]), "totalDigits", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2407                                         }\r
2408                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxInclusiveFacet)) {\r
2409                                                 WriteObject_XmlSchemaMaxInclusiveFacet (((System.Xml.Schema.XmlSchemaMaxInclusiveFacet) ob.@Facets[n113]), "maxInclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2410                                         }\r
2411                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxExclusiveFacet)) {\r
2412                                                 WriteObject_XmlSchemaMaxExclusiveFacet (((System.Xml.Schema.XmlSchemaMaxExclusiveFacet) ob.@Facets[n113]), "maxExclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2413                                         }\r
2414                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMinInclusiveFacet)) {\r
2415                                                 WriteObject_XmlSchemaMinInclusiveFacet (((System.Xml.Schema.XmlSchemaMinInclusiveFacet) ob.@Facets[n113]), "minInclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2416                                         }\r
2417                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMinExclusiveFacet)) {\r
2418                                                 WriteObject_XmlSchemaMinExclusiveFacet (((System.Xml.Schema.XmlSchemaMinExclusiveFacet) ob.@Facets[n113]), "minExclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2419                                         }\r
2420                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaWhiteSpaceFacet)) {\r
2421                                                 WriteObject_XmlSchemaWhiteSpaceFacet (((System.Xml.Schema.XmlSchemaWhiteSpaceFacet) ob.@Facets[n113]), "whiteSpace", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2422                                         }\r
2423                                         else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaPatternFacet)) {\r
2424                                                 WriteObject_XmlSchemaPatternFacet (((System.Xml.Schema.XmlSchemaPatternFacet) ob.@Facets[n113]), "pattern", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2425                                         }\r
2426                                         else throw CreateUnknownTypeException (ob.@Facets[n113]);\r
2427                                 }\r
2428                         }\r
2429                         if (ob.@Attributes != null) {\r
2430                                 for (int n114 = 0; n114 < ob.@Attributes.Count; n114++) {\r
2431                                         if (ob.@Attributes[n114] == null) { }\r
2432                                         else if (ob.@Attributes[n114].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {\r
2433                                                 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n114]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2434                                         }\r
2435                                         else if (ob.@Attributes[n114].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {\r
2436                                                 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n114]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2437                                         }\r
2438                                         else throw CreateUnknownTypeException (ob.@Attributes[n114]);\r
2439                                 }\r
2440                         }\r
2441                         WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);\r
2442                         if (writeWrappingElem) WriteEndElement (ob);\r
2443                 }\r
2444 \r
2445                 protected override void InitCallbacks ()\r
2446                 {\r
2447                 }\r
2448 \r
2449         }\r
2450 \r
2451 }\r
2452 \r