2010-06-21 Atsushi Enomoto <atsushi@ximian.com>
[mcs.git] / class / System.XML / System.Xml.Schema / XmlSchemaSerializer.cs
blob4f6d0a6fa64428eea03d9461e86515050443c84f
1 using System;
2 using System.Xml;
3 using System.Xml.Schema;
4 using System.Xml.Serialization;
5 using System.Text;
6 using System.Collections;
7 using System.Globalization;
9 namespace System.Xml.Schema
12 internal class XmlSchemaSerializationWriter : XmlSerializationWriter
14 const string xmlNamespace = "http://www.w3.org/2000/xmlns/";
15 public void WriteRoot_XmlSchema (object o)
17 WriteStartDocument ();
18 System.Xml.Schema.XmlSchema ob = (System.Xml.Schema.XmlSchema) o;
19 TopLevelElement ();
20 WriteObject_XmlSchema (ob, "schema", "http://www.w3.org/2001/XMLSchema", true, false, true);
23 void WriteObject_XmlSchema (System.Xml.Schema.XmlSchema ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
25 if (ob == null)
27 if (isNullable)
28 WriteNullTagLiteral(element, namesp);
29 return;
32 System.Type type = ob.GetType ();
33 if (type == typeof(System.Xml.Schema.XmlSchema))
35 else {
36 throw CreateUnknownTypeException (ob);
39 if (writeWrappingElem) {
40 WriteStartElement (element, namesp, ob);
43 if (needType) WriteXsiType("XmlSchema", "http://www.w3.org/2001/XMLSchema");
45 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
47 ICollection o0 = ob.@UnhandledAttributes;
48 if (o0 != null) {
49 foreach (XmlAttribute o1 in o0)
50 if (o1.NamespaceURI != xmlNamespace)
51 WriteXmlAttribute (o1, ob);
54 if (ob.@AttributeFormDefault != ((System.Xml.Schema.XmlSchemaForm) System.Xml.Schema.XmlSchemaForm.None)) {
55 WriteAttribute ("attributeFormDefault", "", GetEnumValue_XmlSchemaForm (ob.@AttributeFormDefault));
57 if (ob.@BlockDefault != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {
58 WriteAttribute ("blockDefault", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@BlockDefault));
60 if (ob.@FinalDefault != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {
61 WriteAttribute ("finalDefault", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@FinalDefault));
63 if (ob.@ElementFormDefault != ((System.Xml.Schema.XmlSchemaForm) System.Xml.Schema.XmlSchemaForm.None)) {
64 WriteAttribute ("elementFormDefault", "", GetEnumValue_XmlSchemaForm (ob.@ElementFormDefault));
66 WriteAttribute ("targetNamespace", "", ob.@TargetNamespace);
67 WriteAttribute ("version", "", ob.@Version);
68 WriteAttribute ("id", "", ob.@Id);
70 if (ob.@Includes != null) {
71 for (int n2 = 0; n2 < ob.@Includes.Count; n2++) {
72 if (ob.@Includes[n2] == null) { }
73 else if (ob.@Includes[n2].GetType() == typeof(System.Xml.Schema.XmlSchemaInclude)) {
74 WriteObject_XmlSchemaInclude (((System.Xml.Schema.XmlSchemaInclude) ob.@Includes[n2]), "include", "http://www.w3.org/2001/XMLSchema", false, false, true);
76 else if (ob.@Includes[n2].GetType() == typeof(System.Xml.Schema.XmlSchemaImport)) {
77 WriteObject_XmlSchemaImport (((System.Xml.Schema.XmlSchemaImport) ob.@Includes[n2]), "import", "http://www.w3.org/2001/XMLSchema", false, false, true);
79 else if (ob.@Includes[n2].GetType() == typeof(System.Xml.Schema.XmlSchemaRedefine)) {
80 WriteObject_XmlSchemaRedefine (((System.Xml.Schema.XmlSchemaRedefine) ob.@Includes[n2]), "redefine", "http://www.w3.org/2001/XMLSchema", false, false, true);
82 else throw CreateUnknownTypeException (ob.@Includes[n2]);
85 if (ob.@Items != null) {
86 for (int n3 = 0; n3 < ob.@Items.Count; n3++) {
87 if (ob.@Items[n3] == null) { }
88 else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaElement)) {
89 WriteObject_XmlSchemaElement (((System.Xml.Schema.XmlSchemaElement) ob.@Items[n3]), "element", "http://www.w3.org/2001/XMLSchema", false, false, true);
91 else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaSimpleType)) {
92 WriteObject_XmlSchemaSimpleType (((System.Xml.Schema.XmlSchemaSimpleType) ob.@Items[n3]), "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);
94 else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {
95 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Items[n3]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
97 else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaAnnotation)) {
98 WriteObject_XmlSchemaAnnotation (((System.Xml.Schema.XmlSchemaAnnotation) ob.@Items[n3]), "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
100 else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroup)) {
101 WriteObject_XmlSchemaAttributeGroup (((System.Xml.Schema.XmlSchemaAttributeGroup) ob.@Items[n3]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);
103 else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaGroup)) {
104 WriteObject_XmlSchemaGroup (((System.Xml.Schema.XmlSchemaGroup) ob.@Items[n3]), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);
106 else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaComplexType)) {
107 WriteObject_XmlSchemaComplexType (((System.Xml.Schema.XmlSchemaComplexType) ob.@Items[n3]), "complexType", "http://www.w3.org/2001/XMLSchema", false, false, true);
109 else if (ob.@Items[n3].GetType() == typeof(System.Xml.Schema.XmlSchemaNotation)) {
110 WriteObject_XmlSchemaNotation (((System.Xml.Schema.XmlSchemaNotation) ob.@Items[n3]), "notation", "http://www.w3.org/2001/XMLSchema", false, false, true);
112 else throw CreateUnknownTypeException (ob.@Items[n3]);
115 if (writeWrappingElem) WriteEndElement (ob);
118 void WriteObject_XmlSchemaForm (System.Xml.Schema.XmlSchemaForm ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
120 System.Type type = ob.GetType ();
121 if (type == typeof(System.Xml.Schema.XmlSchemaForm))
123 else {
124 throw CreateUnknownTypeException (ob);
127 if (writeWrappingElem) {
128 WriteStartElement (element, namesp, ob);
131 if (needType) WriteXsiType("XmlSchemaForm", "");
133 Writer.WriteString (GetEnumValue_XmlSchemaForm (ob));
134 if (writeWrappingElem) WriteEndElement (ob);
137 string GetEnumValue_XmlSchemaForm (System.Xml.Schema.XmlSchemaForm val)
139 switch (val)
141 case System.Xml.Schema.XmlSchemaForm.Qualified: return "qualified";
142 case System.Xml.Schema.XmlSchemaForm.Unqualified: return "unqualified";
143 default: return ((long)val).ToString(CultureInfo.InvariantCulture);
147 void WriteObject_XmlSchemaDerivationMethod (System.Xml.Schema.XmlSchemaDerivationMethod ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
149 System.Type type = ob.GetType ();
150 if (type == typeof(System.Xml.Schema.XmlSchemaDerivationMethod))
152 else {
153 throw CreateUnknownTypeException (ob);
156 if (writeWrappingElem) {
157 WriteStartElement (element, namesp, ob);
160 if (needType) WriteXsiType("XmlSchemaDerivationMethod", "");
162 Writer.WriteString (GetEnumValue_XmlSchemaDerivationMethod (ob));
163 if (writeWrappingElem) WriteEndElement (ob);
166 string GetEnumValue_XmlSchemaDerivationMethod (System.Xml.Schema.XmlSchemaDerivationMethod val)
168 switch (val)
170 case System.Xml.Schema.XmlSchemaDerivationMethod.Empty: return "";
171 case System.Xml.Schema.XmlSchemaDerivationMethod.Substitution: return "substitution";
172 case System.Xml.Schema.XmlSchemaDerivationMethod.Extension: return "extension";
173 case System.Xml.Schema.XmlSchemaDerivationMethod.Restriction: return "restriction";
174 case System.Xml.Schema.XmlSchemaDerivationMethod.List: return "list";
175 case System.Xml.Schema.XmlSchemaDerivationMethod.Union: return "union";
176 case System.Xml.Schema.XmlSchemaDerivationMethod.All: return "#all";
177 default:
178 System.Text.StringBuilder sb = new System.Text.StringBuilder ();
179 string[] enumNames = val.ToString().Split (',');
180 foreach (string name in enumNames)
182 switch (name.Trim())
184 case "Empty": sb.Append ("").Append (' '); break;
185 case "Substitution": sb.Append ("substitution").Append (' '); break;
186 case "Extension": sb.Append ("extension").Append (' '); break;
187 case "Restriction": sb.Append ("restriction").Append (' '); break;
188 case "List": sb.Append ("list").Append (' '); break;
189 case "Union": sb.Append ("union").Append (' '); break;
190 case "All": sb.Append ("#all").Append (' '); break;
191 default: sb.Append (name.Trim()).Append (' '); break;
194 return sb.ToString ().Trim();
198 void WriteObject_XmlSchemaInclude (System.Xml.Schema.XmlSchemaInclude ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
200 if (ob == null)
202 if (isNullable)
203 WriteNullTagLiteral(element, namesp);
204 return;
207 System.Type type = ob.GetType ();
208 if (type == typeof(System.Xml.Schema.XmlSchemaInclude))
210 else {
211 throw CreateUnknownTypeException (ob);
214 if (writeWrappingElem) {
215 WriteStartElement (element, namesp, ob);
218 if (needType) WriteXsiType("XmlSchemaInclude", "http://www.w3.org/2001/XMLSchema");
220 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
222 ICollection o4 = ob.@UnhandledAttributes;
223 if (o4 != null) {
224 foreach (XmlAttribute o5 in o4)
225 if (o5.NamespaceURI != xmlNamespace)
226 WriteXmlAttribute (o5, ob);
229 WriteAttribute ("schemaLocation", "", ob.@SchemaLocation);
230 WriteAttribute ("id", "", ob.@Id);
232 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
233 if (writeWrappingElem) WriteEndElement (ob);
236 void WriteObject_XmlSchemaImport (System.Xml.Schema.XmlSchemaImport ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
238 if (ob == null)
240 if (isNullable)
241 WriteNullTagLiteral(element, namesp);
242 return;
245 System.Type type = ob.GetType ();
246 if (type == typeof(System.Xml.Schema.XmlSchemaImport))
248 else {
249 throw CreateUnknownTypeException (ob);
252 if (writeWrappingElem) {
253 WriteStartElement (element, namesp, ob);
256 if (needType) WriteXsiType("XmlSchemaImport", "http://www.w3.org/2001/XMLSchema");
258 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
260 ICollection o6 = ob.@UnhandledAttributes;
261 if (o6 != null) {
262 foreach (XmlAttribute o7 in o6)
263 if (o7.NamespaceURI != xmlNamespace)
264 WriteXmlAttribute (o7, ob);
267 WriteAttribute ("schemaLocation", "", ob.@SchemaLocation);
268 WriteAttribute ("id", "", ob.@Id);
269 WriteAttribute ("namespace", "", ob.@Namespace);
271 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
272 if (writeWrappingElem) WriteEndElement (ob);
275 void WriteObject_XmlSchemaRedefine (System.Xml.Schema.XmlSchemaRedefine ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
277 if (ob == null)
279 if (isNullable)
280 WriteNullTagLiteral(element, namesp);
281 return;
284 System.Type type = ob.GetType ();
285 if (type == typeof(System.Xml.Schema.XmlSchemaRedefine))
287 else {
288 throw CreateUnknownTypeException (ob);
291 if (writeWrappingElem) {
292 WriteStartElement (element, namesp, ob);
295 if (needType) WriteXsiType("XmlSchemaRedefine", "http://www.w3.org/2001/XMLSchema");
297 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
299 ICollection o8 = ob.@UnhandledAttributes;
300 if (o8 != null) {
301 foreach (XmlAttribute o9 in o8)
302 if (o9.NamespaceURI != xmlNamespace)
303 WriteXmlAttribute (o9, ob);
306 WriteAttribute ("schemaLocation", "", ob.@SchemaLocation);
307 WriteAttribute ("id", "", ob.@Id);
309 if (ob.@Items != null) {
310 for (int n10 = 0; n10 < ob.@Items.Count; n10++) {
311 if (ob.@Items[n10] == null) { }
312 else if (ob.@Items[n10].GetType() == typeof(System.Xml.Schema.XmlSchemaGroup)) {
313 WriteObject_XmlSchemaGroup (((System.Xml.Schema.XmlSchemaGroup) ob.@Items[n10]), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);
315 else if (ob.@Items[n10].GetType() == typeof(System.Xml.Schema.XmlSchemaComplexType)) {
316 WriteObject_XmlSchemaComplexType (((System.Xml.Schema.XmlSchemaComplexType) ob.@Items[n10]), "complexType", "http://www.w3.org/2001/XMLSchema", false, false, true);
318 else if (ob.@Items[n10].GetType() == typeof(System.Xml.Schema.XmlSchemaSimpleType)) {
319 WriteObject_XmlSchemaSimpleType (((System.Xml.Schema.XmlSchemaSimpleType) ob.@Items[n10]), "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);
321 else if (ob.@Items[n10].GetType() == typeof(System.Xml.Schema.XmlSchemaAnnotation)) {
322 WriteObject_XmlSchemaAnnotation (((System.Xml.Schema.XmlSchemaAnnotation) ob.@Items[n10]), "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
324 else if (ob.@Items[n10].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroup)) {
325 WriteObject_XmlSchemaAttributeGroup (((System.Xml.Schema.XmlSchemaAttributeGroup) ob.@Items[n10]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);
327 else throw CreateUnknownTypeException (ob.@Items[n10]);
330 if (writeWrappingElem) WriteEndElement (ob);
333 void WriteObject_XmlSchemaElement (System.Xml.Schema.XmlSchemaElement ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
335 if (ob == null)
337 if (isNullable)
338 WriteNullTagLiteral(element, namesp);
339 return;
342 System.Type type = ob.GetType ();
343 if (type == typeof(System.Xml.Schema.XmlSchemaElement))
345 else {
346 throw CreateUnknownTypeException (ob);
349 if (writeWrappingElem) {
350 WriteStartElement (element, namesp, ob);
353 if (needType) WriteXsiType("XmlSchemaElement", "http://www.w3.org/2001/XMLSchema");
355 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
357 ICollection o11 = ob.@UnhandledAttributes;
358 if (o11 != null) {
359 foreach (XmlAttribute o12 in o11)
360 if (o12.NamespaceURI != xmlNamespace)
361 WriteXmlAttribute (o12, ob);
364 WriteAttribute ("id", "", ob.@Id);
365 WriteAttribute ("minOccurs", "", ob.@MinOccursString);
366 WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);
367 if (ob.@IsAbstract != false) {
368 WriteAttribute ("abstract", "", (ob.@IsAbstract?"true":"false"));
370 if (ob.@Block != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {
371 WriteAttribute ("block", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@Block));
373 if (ob.@DefaultValue != null) {
374 WriteAttribute ("default", "", ob.@DefaultValue);
376 if (ob.@Final != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {
377 WriteAttribute ("final", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@Final));
379 if (ob.@FixedValue != null) {
380 WriteAttribute ("fixed", "", ob.@FixedValue);
382 if (ob.@Form != ((System.Xml.Schema.XmlSchemaForm) System.Xml.Schema.XmlSchemaForm.None)) {
383 WriteAttribute ("form", "", GetEnumValue_XmlSchemaForm (ob.@Form));
385 if (ob.@Name != null) {
386 WriteAttribute ("name", "", ob.@Name);
388 if (ob.@IsNillable != false) {
389 WriteAttribute ("nillable", "", (ob.@IsNillable?"true":"false"));
391 WriteAttribute ("ref", "", FromXmlQualifiedName (ob.@RefName));
392 WriteAttribute ("substitutionGroup", "", FromXmlQualifiedName (ob.@SubstitutionGroup));
393 WriteAttribute ("type", "", FromXmlQualifiedName (ob.@SchemaTypeName));
395 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
396 if (ob.@SchemaType is System.Xml.Schema.XmlSchemaSimpleType) {
397 WriteObject_XmlSchemaSimpleType (((System.Xml.Schema.XmlSchemaSimpleType) ob.@SchemaType), "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);
399 else if (ob.@SchemaType is System.Xml.Schema.XmlSchemaComplexType) {
400 WriteObject_XmlSchemaComplexType (((System.Xml.Schema.XmlSchemaComplexType) ob.@SchemaType), "complexType", "http://www.w3.org/2001/XMLSchema", false, false, true);
402 if (ob.@Constraints != null) {
403 for (int n13 = 0; n13 < ob.@Constraints.Count; n13++) {
404 if (ob.@Constraints[n13] == null) { }
405 else if (ob.@Constraints[n13].GetType() == typeof(System.Xml.Schema.XmlSchemaKeyref)) {
406 WriteObject_XmlSchemaKeyref (((System.Xml.Schema.XmlSchemaKeyref) ob.@Constraints[n13]), "keyref", "http://www.w3.org/2001/XMLSchema", false, false, true);
408 else if (ob.@Constraints[n13].GetType() == typeof(System.Xml.Schema.XmlSchemaKey)) {
409 WriteObject_XmlSchemaKey (((System.Xml.Schema.XmlSchemaKey) ob.@Constraints[n13]), "key", "http://www.w3.org/2001/XMLSchema", false, false, true);
411 else if (ob.@Constraints[n13].GetType() == typeof(System.Xml.Schema.XmlSchemaUnique)) {
412 WriteObject_XmlSchemaUnique (((System.Xml.Schema.XmlSchemaUnique) ob.@Constraints[n13]), "unique", "http://www.w3.org/2001/XMLSchema", false, false, true);
414 else throw CreateUnknownTypeException (ob.@Constraints[n13]);
417 if (writeWrappingElem) WriteEndElement (ob);
420 void WriteObject_XmlSchemaSimpleType (System.Xml.Schema.XmlSchemaSimpleType ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
422 if (ob == null)
424 if (isNullable)
425 WriteNullTagLiteral(element, namesp);
426 return;
429 System.Type type = ob.GetType ();
430 if (type == typeof(System.Xml.Schema.XmlSchemaSimpleType))
432 else {
433 throw CreateUnknownTypeException (ob);
436 if (writeWrappingElem) {
437 WriteStartElement (element, namesp, ob);
440 if (needType) WriteXsiType("XmlSchemaSimpleType", "http://www.w3.org/2001/XMLSchema");
442 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
444 ICollection o14 = ob.@UnhandledAttributes;
445 if (o14 != null) {
446 foreach (XmlAttribute o15 in o14)
447 if (o15.NamespaceURI != xmlNamespace)
448 WriteXmlAttribute (o15, ob);
451 WriteAttribute ("id", "", ob.@Id);
452 WriteAttribute ("name", "", ob.@Name);
453 if (ob.@Final != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {
454 WriteAttribute ("final", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@Final));
457 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
458 if (ob.@Content is System.Xml.Schema.XmlSchemaSimpleTypeUnion) {
459 WriteObject_XmlSchemaSimpleTypeUnion (((System.Xml.Schema.XmlSchemaSimpleTypeUnion) ob.@Content), "union", "http://www.w3.org/2001/XMLSchema", false, false, true);
461 else if (ob.@Content is System.Xml.Schema.XmlSchemaSimpleTypeList) {
462 WriteObject_XmlSchemaSimpleTypeList (((System.Xml.Schema.XmlSchemaSimpleTypeList) ob.@Content), "list", "http://www.w3.org/2001/XMLSchema", false, false, true);
464 else if (ob.@Content is System.Xml.Schema.XmlSchemaSimpleTypeRestriction) {
465 WriteObject_XmlSchemaSimpleTypeRestriction (((System.Xml.Schema.XmlSchemaSimpleTypeRestriction) ob.@Content), "restriction", "http://www.w3.org/2001/XMLSchema", false, false, true);
467 if (writeWrappingElem) WriteEndElement (ob);
470 void WriteObject_XmlSchemaAttribute (System.Xml.Schema.XmlSchemaAttribute ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
472 if (ob == null)
474 if (isNullable)
475 WriteNullTagLiteral(element, namesp);
476 return;
479 System.Type type = ob.GetType ();
480 if (type == typeof(System.Xml.Schema.XmlSchemaAttribute))
482 else {
483 throw CreateUnknownTypeException (ob);
486 if (writeWrappingElem) {
487 WriteStartElement (element, namesp, ob);
490 if (needType) WriteXsiType("XmlSchemaAttribute", "http://www.w3.org/2001/XMLSchema");
492 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
494 ICollection o16 = ob.@UnhandledAttributes;
495 if (o16 != null) {
496 foreach (XmlAttribute o17 in o16)
497 if (o17.NamespaceURI != xmlNamespace)
498 WriteXmlAttribute (o17, ob);
501 WriteAttribute ("id", "", ob.@Id);
502 if (ob.@DefaultValue != null) {
503 WriteAttribute ("default", "", ob.@DefaultValue);
505 if (ob.@FixedValue != null) {
506 WriteAttribute ("fixed", "", ob.@FixedValue);
508 if (ob.@Form != ((System.Xml.Schema.XmlSchemaForm) System.Xml.Schema.XmlSchemaForm.None)) {
509 WriteAttribute ("form", "", GetEnumValue_XmlSchemaForm (ob.@Form));
511 WriteAttribute ("name", "", ob.@Name);
512 WriteAttribute ("ref", "", FromXmlQualifiedName (ob.@RefName));
513 WriteAttribute ("type", "", FromXmlQualifiedName (ob.@SchemaTypeName));
514 if (ob.@Use != ((System.Xml.Schema.XmlSchemaUse) System.Xml.Schema.XmlSchemaUse.None)) {
515 WriteAttribute ("use", "", GetEnumValue_XmlSchemaUse (ob.@Use));
518 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
519 WriteObject_XmlSchemaSimpleType (ob.@SchemaType, "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);
520 if (writeWrappingElem) WriteEndElement (ob);
523 void WriteObject_XmlSchemaAnnotation (System.Xml.Schema.XmlSchemaAnnotation ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
525 if (ob == null)
527 if (isNullable)
528 WriteNullTagLiteral(element, namesp);
529 return;
532 System.Type type = ob.GetType ();
533 if (type == typeof(System.Xml.Schema.XmlSchemaAnnotation))
535 else {
536 throw CreateUnknownTypeException (ob);
539 if (writeWrappingElem) {
540 WriteStartElement (element, namesp, ob);
543 if (needType) WriteXsiType("XmlSchemaAnnotation", "http://www.w3.org/2001/XMLSchema");
545 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
547 ICollection o18 = ob.@UnhandledAttributes;
548 if (o18 != null) {
549 foreach (XmlAttribute o19 in o18)
550 if (o19.NamespaceURI != xmlNamespace)
551 WriteXmlAttribute (o19, ob);
554 WriteAttribute ("id", "", ob.@Id);
556 if (ob.@Items != null) {
557 for (int n20 = 0; n20 < ob.@Items.Count; n20++) {
558 if (ob.@Items[n20] == null) { }
559 else if (ob.@Items[n20].GetType() == typeof(System.Xml.Schema.XmlSchemaAppInfo)) {
560 WriteObject_XmlSchemaAppInfo (((System.Xml.Schema.XmlSchemaAppInfo) ob.@Items[n20]), "appinfo", "http://www.w3.org/2001/XMLSchema", false, false, true);
562 else if (ob.@Items[n20].GetType() == typeof(System.Xml.Schema.XmlSchemaDocumentation)) {
563 WriteObject_XmlSchemaDocumentation (((System.Xml.Schema.XmlSchemaDocumentation) ob.@Items[n20]), "documentation", "http://www.w3.org/2001/XMLSchema", false, false, true);
565 else throw CreateUnknownTypeException (ob.@Items[n20]);
568 if (writeWrappingElem) WriteEndElement (ob);
571 void WriteObject_XmlSchemaAttributeGroup (System.Xml.Schema.XmlSchemaAttributeGroup ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
573 if (ob == null)
575 if (isNullable)
576 WriteNullTagLiteral(element, namesp);
577 return;
580 System.Type type = ob.GetType ();
581 if (type == typeof(System.Xml.Schema.XmlSchemaAttributeGroup))
583 else {
584 throw CreateUnknownTypeException (ob);
587 if (writeWrappingElem) {
588 WriteStartElement (element, namesp, ob);
591 if (needType) WriteXsiType("XmlSchemaAttributeGroup", "http://www.w3.org/2001/XMLSchema");
593 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
595 ICollection o21 = ob.@UnhandledAttributes;
596 if (o21 != null) {
597 foreach (XmlAttribute o22 in o21)
598 if (o22.NamespaceURI != xmlNamespace)
599 WriteXmlAttribute (o22, ob);
602 WriteAttribute ("id", "", ob.@Id);
603 WriteAttribute ("name", "", ob.@Name);
605 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
606 if (ob.@Attributes != null) {
607 for (int n23 = 0; n23 < ob.@Attributes.Count; n23++) {
608 if (ob.@Attributes[n23] == null) { }
609 else if (ob.@Attributes[n23].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {
610 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n23]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
612 else if (ob.@Attributes[n23].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {
613 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n23]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);
615 else throw CreateUnknownTypeException (ob.@Attributes[n23]);
618 WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
619 if (writeWrappingElem) WriteEndElement (ob);
622 void WriteObject_XmlSchemaGroup (System.Xml.Schema.XmlSchemaGroup ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
624 if (ob == null)
626 if (isNullable)
627 WriteNullTagLiteral(element, namesp);
628 return;
631 System.Type type = ob.GetType ();
632 if (type == typeof(System.Xml.Schema.XmlSchemaGroup))
634 else {
635 throw CreateUnknownTypeException (ob);
638 if (writeWrappingElem) {
639 WriteStartElement (element, namesp, ob);
642 if (needType) WriteXsiType("XmlSchemaGroup", "http://www.w3.org/2001/XMLSchema");
644 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
646 ICollection o24 = ob.@UnhandledAttributes;
647 if (o24 != null) {
648 foreach (XmlAttribute o25 in o24)
649 if (o25.NamespaceURI != xmlNamespace)
650 WriteXmlAttribute (o25, ob);
653 WriteAttribute ("id", "", ob.@Id);
654 WriteAttribute ("name", "", ob.@Name);
656 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
657 if (ob.@Particle is System.Xml.Schema.XmlSchemaSequence) {
658 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Particle), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);
660 else if (ob.@Particle is System.Xml.Schema.XmlSchemaChoice) {
661 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Particle), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);
663 else if (ob.@Particle is System.Xml.Schema.XmlSchemaAll) {
664 WriteObject_XmlSchemaAll (((System.Xml.Schema.XmlSchemaAll) ob.@Particle), "all", "http://www.w3.org/2001/XMLSchema", false, false, true);
666 if (writeWrappingElem) WriteEndElement (ob);
669 void WriteObject_XmlSchemaComplexType (System.Xml.Schema.XmlSchemaComplexType ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
671 if (ob == null)
673 if (isNullable)
674 WriteNullTagLiteral(element, namesp);
675 return;
678 System.Type type = ob.GetType ();
679 if (type == typeof(System.Xml.Schema.XmlSchemaComplexType))
681 else {
682 throw CreateUnknownTypeException (ob);
685 if (writeWrappingElem) {
686 WriteStartElement (element, namesp, ob);
689 if (needType) WriteXsiType("XmlSchemaComplexType", "http://www.w3.org/2001/XMLSchema");
691 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
693 ICollection o26 = ob.@UnhandledAttributes;
694 if (o26 != null) {
695 foreach (XmlAttribute o27 in o26)
696 if (o27.NamespaceURI != xmlNamespace)
697 WriteXmlAttribute (o27, ob);
700 WriteAttribute ("id", "", ob.@Id);
701 WriteAttribute ("name", "", ob.@Name);
702 if (ob.@Final != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {
703 WriteAttribute ("final", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@Final));
705 if (ob.@IsAbstract != false) {
706 WriteAttribute ("abstract", "", (ob.@IsAbstract?"true":"false"));
708 if (ob.@Block != ((System.Xml.Schema.XmlSchemaDerivationMethod) System.Xml.Schema.XmlSchemaDerivationMethod.None)) {
709 WriteAttribute ("block", "", GetEnumValue_XmlSchemaDerivationMethod (ob.@Block));
711 if (ob.@IsMixed != false) {
712 WriteAttribute ("mixed", "", (ob.@IsMixed?"true":"false"));
715 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
716 if (ob.@ContentModel is System.Xml.Schema.XmlSchemaComplexContent) {
717 WriteObject_XmlSchemaComplexContent (((System.Xml.Schema.XmlSchemaComplexContent) ob.@ContentModel), "complexContent", "http://www.w3.org/2001/XMLSchema", false, false, true);
719 else if (ob.@ContentModel is System.Xml.Schema.XmlSchemaSimpleContent) {
720 WriteObject_XmlSchemaSimpleContent (((System.Xml.Schema.XmlSchemaSimpleContent) ob.@ContentModel), "simpleContent", "http://www.w3.org/2001/XMLSchema", false, false, true);
722 if (ob.@Particle is System.Xml.Schema.XmlSchemaAll) {
723 WriteObject_XmlSchemaAll (((System.Xml.Schema.XmlSchemaAll) ob.@Particle), "all", "http://www.w3.org/2001/XMLSchema", false, false, true);
725 else if (ob.@Particle is System.Xml.Schema.XmlSchemaGroupRef) {
726 WriteObject_XmlSchemaGroupRef (((System.Xml.Schema.XmlSchemaGroupRef) ob.@Particle), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);
728 else if (ob.@Particle is System.Xml.Schema.XmlSchemaSequence) {
729 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Particle), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);
731 else if (ob.@Particle is System.Xml.Schema.XmlSchemaChoice) {
732 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Particle), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);
734 if (ob.@Attributes != null) {
735 for (int n28 = 0; n28 < ob.@Attributes.Count; n28++) {
736 if (ob.@Attributes[n28] == null) { }
737 else if (ob.@Attributes[n28].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {
738 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n28]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);
740 else if (ob.@Attributes[n28].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {
741 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n28]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
743 else throw CreateUnknownTypeException (ob.@Attributes[n28]);
746 WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
747 if (writeWrappingElem) WriteEndElement (ob);
750 void WriteObject_XmlSchemaNotation (System.Xml.Schema.XmlSchemaNotation ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
752 if (ob == null)
754 if (isNullable)
755 WriteNullTagLiteral(element, namesp);
756 return;
759 System.Type type = ob.GetType ();
760 if (type == typeof(System.Xml.Schema.XmlSchemaNotation))
762 else {
763 throw CreateUnknownTypeException (ob);
766 if (writeWrappingElem) {
767 WriteStartElement (element, namesp, ob);
770 if (needType) WriteXsiType("XmlSchemaNotation", "http://www.w3.org/2001/XMLSchema");
772 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
774 ICollection o29 = ob.@UnhandledAttributes;
775 if (o29 != null) {
776 foreach (XmlAttribute o30 in o29)
777 if (o30.NamespaceURI != xmlNamespace)
778 WriteXmlAttribute (o30, ob);
781 WriteAttribute ("id", "", ob.@Id);
782 WriteAttribute ("name", "", ob.@Name);
783 WriteAttribute ("public", "", ob.@Public);
784 WriteAttribute ("system", "", ob.@System);
786 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
787 if (writeWrappingElem) WriteEndElement (ob);
790 void WriteObject_XmlSchemaKeyref (System.Xml.Schema.XmlSchemaKeyref ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
792 if (ob == null)
794 if (isNullable)
795 WriteNullTagLiteral(element, namesp);
796 return;
799 System.Type type = ob.GetType ();
800 if (type == typeof(System.Xml.Schema.XmlSchemaKeyref))
802 else {
803 throw CreateUnknownTypeException (ob);
806 if (writeWrappingElem) {
807 WriteStartElement (element, namesp, ob);
810 if (needType) WriteXsiType("XmlSchemaKeyref", "http://www.w3.org/2001/XMLSchema");
812 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
814 ICollection o31 = ob.@UnhandledAttributes;
815 if (o31 != null) {
816 foreach (XmlAttribute o32 in o31)
817 if (o32.NamespaceURI != xmlNamespace)
818 WriteXmlAttribute (o32, ob);
821 WriteAttribute ("id", "", ob.@Id);
822 WriteAttribute ("name", "", ob.@Name);
823 WriteAttribute ("refer", "", FromXmlQualifiedName (ob.@Refer));
825 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
826 WriteObject_XmlSchemaXPath (ob.@Selector, "selector", "http://www.w3.org/2001/XMLSchema", false, false, true);
827 if (ob.@Fields != null) {
828 for (int n33 = 0; n33 < ob.@Fields.Count; n33++) {
829 WriteObject_XmlSchemaXPath (((System.Xml.Schema.XmlSchemaXPath) ob.@Fields[n33]), "field", "http://www.w3.org/2001/XMLSchema", false, false, true);
832 if (writeWrappingElem) WriteEndElement (ob);
835 void WriteObject_XmlSchemaKey (System.Xml.Schema.XmlSchemaKey ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
837 if (ob == null)
839 if (isNullable)
840 WriteNullTagLiteral(element, namesp);
841 return;
844 System.Type type = ob.GetType ();
845 if (type == typeof(System.Xml.Schema.XmlSchemaKey))
847 else {
848 throw CreateUnknownTypeException (ob);
851 if (writeWrappingElem) {
852 WriteStartElement (element, namesp, ob);
855 if (needType) WriteXsiType("XmlSchemaKey", "http://www.w3.org/2001/XMLSchema");
857 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
859 ICollection o34 = ob.@UnhandledAttributes;
860 if (o34 != null) {
861 foreach (XmlAttribute o35 in o34)
862 if (o35.NamespaceURI != xmlNamespace)
863 WriteXmlAttribute (o35, ob);
866 WriteAttribute ("id", "", ob.@Id);
867 WriteAttribute ("name", "", ob.@Name);
869 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
870 WriteObject_XmlSchemaXPath (ob.@Selector, "selector", "http://www.w3.org/2001/XMLSchema", false, false, true);
871 if (ob.@Fields != null) {
872 for (int n36 = 0; n36 < ob.@Fields.Count; n36++) {
873 WriteObject_XmlSchemaXPath (((System.Xml.Schema.XmlSchemaXPath) ob.@Fields[n36]), "field", "http://www.w3.org/2001/XMLSchema", false, false, true);
876 if (writeWrappingElem) WriteEndElement (ob);
879 void WriteObject_XmlSchemaUnique (System.Xml.Schema.XmlSchemaUnique ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
881 if (ob == null)
883 if (isNullable)
884 WriteNullTagLiteral(element, namesp);
885 return;
888 System.Type type = ob.GetType ();
889 if (type == typeof(System.Xml.Schema.XmlSchemaUnique))
891 else {
892 throw CreateUnknownTypeException (ob);
895 if (writeWrappingElem) {
896 WriteStartElement (element, namesp, ob);
899 if (needType) WriteXsiType("XmlSchemaUnique", "http://www.w3.org/2001/XMLSchema");
901 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
903 ICollection o37 = ob.@UnhandledAttributes;
904 if (o37 != null) {
905 foreach (XmlAttribute o38 in o37)
906 if (o38.NamespaceURI != xmlNamespace)
907 WriteXmlAttribute (o38, ob);
910 WriteAttribute ("id", "", ob.@Id);
911 WriteAttribute ("name", "", ob.@Name);
913 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
914 WriteObject_XmlSchemaXPath (ob.@Selector, "selector", "http://www.w3.org/2001/XMLSchema", false, false, true);
915 if (ob.@Fields != null) {
916 for (int n39 = 0; n39 < ob.@Fields.Count; n39++) {
917 WriteObject_XmlSchemaXPath (((System.Xml.Schema.XmlSchemaXPath) ob.@Fields[n39]), "field", "http://www.w3.org/2001/XMLSchema", false, false, true);
920 if (writeWrappingElem) WriteEndElement (ob);
923 void WriteObject_XmlSchemaSimpleTypeUnion (System.Xml.Schema.XmlSchemaSimpleTypeUnion ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
925 if (ob == null)
927 if (isNullable)
928 WriteNullTagLiteral(element, namesp);
929 return;
932 System.Type type = ob.GetType ();
933 if (type == typeof(System.Xml.Schema.XmlSchemaSimpleTypeUnion))
935 else {
936 throw CreateUnknownTypeException (ob);
939 if (writeWrappingElem) {
940 WriteStartElement (element, namesp, ob);
943 if (needType) WriteXsiType("XmlSchemaSimpleTypeUnion", "http://www.w3.org/2001/XMLSchema");
945 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
947 ICollection o40 = ob.@UnhandledAttributes;
948 if (o40 != null) {
949 foreach (XmlAttribute o41 in o40)
950 if (o41.NamespaceURI != xmlNamespace)
951 WriteXmlAttribute (o41, ob);
954 WriteAttribute ("id", "", ob.@Id);
955 string s42 = null;
956 if (ob.@MemberTypes != null) {
957 System.Text.StringBuilder s43 = new System.Text.StringBuilder();
958 for (int n44 = 0; n44 < ob.@MemberTypes.Length; n44++) {
959 s43.Append (FromXmlQualifiedName (ob.@MemberTypes[n44])).Append (" ");
961 s42 = s43.ToString ().Trim ();
963 WriteAttribute ("memberTypes", "", s42);
965 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
966 if (ob.@BaseTypes != null) {
967 for (int n45 = 0; n45 < ob.@BaseTypes.Count; n45++) {
968 WriteObject_XmlSchemaSimpleType (((System.Xml.Schema.XmlSchemaSimpleType) ob.@BaseTypes[n45]), "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);
971 if (writeWrappingElem) WriteEndElement (ob);
974 void WriteObject_XmlSchemaSimpleTypeList (System.Xml.Schema.XmlSchemaSimpleTypeList ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
976 if (ob == null)
978 if (isNullable)
979 WriteNullTagLiteral(element, namesp);
980 return;
983 System.Type type = ob.GetType ();
984 if (type == typeof(System.Xml.Schema.XmlSchemaSimpleTypeList))
986 else {
987 throw CreateUnknownTypeException (ob);
990 if (writeWrappingElem) {
991 WriteStartElement (element, namesp, ob);
994 if (needType) WriteXsiType("XmlSchemaSimpleTypeList", "http://www.w3.org/2001/XMLSchema");
996 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
998 ICollection o46 = ob.@UnhandledAttributes;
999 if (o46 != null) {
1000 foreach (XmlAttribute o47 in o46)
1001 if (o47.NamespaceURI != xmlNamespace)
1002 WriteXmlAttribute (o47, ob);
1005 WriteAttribute ("id", "", ob.@Id);
1006 WriteAttribute ("itemType", "", FromXmlQualifiedName (ob.@ItemTypeName));
1008 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1009 WriteObject_XmlSchemaSimpleType (ob.@ItemType, "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);
1010 if (writeWrappingElem) WriteEndElement (ob);
1013 void WriteObject_XmlSchemaSimpleTypeRestriction (System.Xml.Schema.XmlSchemaSimpleTypeRestriction ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1015 if (ob == null)
1017 if (isNullable)
1018 WriteNullTagLiteral(element, namesp);
1019 return;
1022 System.Type type = ob.GetType ();
1023 if (type == typeof(System.Xml.Schema.XmlSchemaSimpleTypeRestriction))
1025 else {
1026 throw CreateUnknownTypeException (ob);
1029 if (writeWrappingElem) {
1030 WriteStartElement (element, namesp, ob);
1033 if (needType) WriteXsiType("XmlSchemaSimpleTypeRestriction", "http://www.w3.org/2001/XMLSchema");
1035 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1037 ICollection o48 = ob.@UnhandledAttributes;
1038 if (o48 != null) {
1039 foreach (XmlAttribute o49 in o48)
1040 if (o49.NamespaceURI != xmlNamespace)
1041 WriteXmlAttribute (o49, ob);
1044 WriteAttribute ("id", "", ob.@Id);
1045 WriteAttribute ("base", "", FromXmlQualifiedName (ob.@BaseTypeName));
1047 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1048 WriteObject_XmlSchemaSimpleType (ob.@BaseType, "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);
1049 if (ob.@Facets != null) {
1050 for (int n50 = 0; n50 < ob.@Facets.Count; n50++) {
1051 if (ob.@Facets[n50] == null) { }
1052 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxLengthFacet)) {
1053 WriteObject_XmlSchemaMaxLengthFacet (((System.Xml.Schema.XmlSchemaMaxLengthFacet) ob.@Facets[n50]), "maxLength", "http://www.w3.org/2001/XMLSchema", false, false, true);
1055 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMinLengthFacet)) {
1056 WriteObject_XmlSchemaMinLengthFacet (((System.Xml.Schema.XmlSchemaMinLengthFacet) ob.@Facets[n50]), "minLength", "http://www.w3.org/2001/XMLSchema", false, false, true);
1058 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaLengthFacet)) {
1059 WriteObject_XmlSchemaLengthFacet (((System.Xml.Schema.XmlSchemaLengthFacet) ob.@Facets[n50]), "length", "http://www.w3.org/2001/XMLSchema", false, false, true);
1061 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaFractionDigitsFacet)) {
1062 WriteObject_XmlSchemaFractionDigitsFacet (((System.Xml.Schema.XmlSchemaFractionDigitsFacet) ob.@Facets[n50]), "fractionDigits", "http://www.w3.org/2001/XMLSchema", false, false, true);
1064 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxInclusiveFacet)) {
1065 WriteObject_XmlSchemaMaxInclusiveFacet (((System.Xml.Schema.XmlSchemaMaxInclusiveFacet) ob.@Facets[n50]), "maxInclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);
1067 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxExclusiveFacet)) {
1068 WriteObject_XmlSchemaMaxExclusiveFacet (((System.Xml.Schema.XmlSchemaMaxExclusiveFacet) ob.@Facets[n50]), "maxExclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);
1070 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMinExclusiveFacet)) {
1071 WriteObject_XmlSchemaMinExclusiveFacet (((System.Xml.Schema.XmlSchemaMinExclusiveFacet) ob.@Facets[n50]), "minExclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);
1073 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaEnumerationFacet)) {
1074 WriteObject_XmlSchemaEnumerationFacet (((System.Xml.Schema.XmlSchemaEnumerationFacet) ob.@Facets[n50]), "enumeration", "http://www.w3.org/2001/XMLSchema", false, false, true);
1076 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaTotalDigitsFacet)) {
1077 WriteObject_XmlSchemaTotalDigitsFacet (((System.Xml.Schema.XmlSchemaTotalDigitsFacet) ob.@Facets[n50]), "totalDigits", "http://www.w3.org/2001/XMLSchema", false, false, true);
1079 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaMinInclusiveFacet)) {
1080 WriteObject_XmlSchemaMinInclusiveFacet (((System.Xml.Schema.XmlSchemaMinInclusiveFacet) ob.@Facets[n50]), "minInclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);
1082 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaWhiteSpaceFacet)) {
1083 WriteObject_XmlSchemaWhiteSpaceFacet (((System.Xml.Schema.XmlSchemaWhiteSpaceFacet) ob.@Facets[n50]), "whiteSpace", "http://www.w3.org/2001/XMLSchema", false, false, true);
1085 else if (ob.@Facets[n50].GetType() == typeof(System.Xml.Schema.XmlSchemaPatternFacet)) {
1086 WriteObject_XmlSchemaPatternFacet (((System.Xml.Schema.XmlSchemaPatternFacet) ob.@Facets[n50]), "pattern", "http://www.w3.org/2001/XMLSchema", false, false, true);
1088 else throw CreateUnknownTypeException (ob.@Facets[n50]);
1091 if (writeWrappingElem) WriteEndElement (ob);
1094 void WriteObject_XmlSchemaUse (System.Xml.Schema.XmlSchemaUse ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1096 System.Type type = ob.GetType ();
1097 if (type == typeof(System.Xml.Schema.XmlSchemaUse))
1099 else {
1100 throw CreateUnknownTypeException (ob);
1103 if (writeWrappingElem) {
1104 WriteStartElement (element, namesp, ob);
1107 if (needType) WriteXsiType("XmlSchemaUse", "");
1109 Writer.WriteString (GetEnumValue_XmlSchemaUse (ob));
1110 if (writeWrappingElem) WriteEndElement (ob);
1113 string GetEnumValue_XmlSchemaUse (System.Xml.Schema.XmlSchemaUse val)
1115 switch (val)
1117 case System.Xml.Schema.XmlSchemaUse.Optional: return "optional";
1118 case System.Xml.Schema.XmlSchemaUse.Prohibited: return "prohibited";
1119 case System.Xml.Schema.XmlSchemaUse.Required: return "required";
1120 default: return ((long)val).ToString(CultureInfo.InvariantCulture);
1124 void WriteObject_XmlSchemaAppInfo (System.Xml.Schema.XmlSchemaAppInfo ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1126 if (ob == null)
1128 if (isNullable)
1129 WriteNullTagLiteral(element, namesp);
1130 return;
1133 System.Type type = ob.GetType ();
1134 if (type == typeof(System.Xml.Schema.XmlSchemaAppInfo))
1136 else {
1137 throw CreateUnknownTypeException (ob);
1140 if (writeWrappingElem) {
1141 WriteStartElement (element, namesp, ob);
1144 if (needType) WriteXsiType("XmlSchemaAppInfo", "http://www.w3.org/2001/XMLSchema");
1146 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1148 WriteAttribute ("source", "", ob.@Source);
1150 if (ob.@Markup != null) {
1151 foreach (XmlNode o51 in ob.@Markup) {
1152 XmlNode o52 = o51;
1153 if (o52 is XmlElement) {
1154 WriteElementLiteral (o52, "", "", false, true);
1155 } else o52.WriteTo (Writer);
1158 if (writeWrappingElem) WriteEndElement (ob);
1161 void WriteObject_XmlSchemaDocumentation (System.Xml.Schema.XmlSchemaDocumentation ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1163 if (ob == null)
1165 if (isNullable)
1166 WriteNullTagLiteral(element, namesp);
1167 return;
1170 System.Type type = ob.GetType ();
1171 if (type == typeof(System.Xml.Schema.XmlSchemaDocumentation))
1173 else {
1174 throw CreateUnknownTypeException (ob);
1177 if (writeWrappingElem) {
1178 WriteStartElement (element, namesp, ob);
1181 if (needType) WriteXsiType("XmlSchemaDocumentation", "http://www.w3.org/2001/XMLSchema");
1183 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1185 WriteAttribute ("source", "", ob.@Source);
1186 WriteAttribute ("xml:lang", "", ob.@Language);
1188 if (ob.@Markup != null) {
1189 foreach (XmlNode o53 in ob.@Markup) {
1190 XmlNode o54 = o53;
1191 if (o54 is XmlElement) {
1192 WriteElementLiteral (o54, "", "", false, true);
1193 } else o54.WriteTo (Writer);
1196 if (writeWrappingElem) WriteEndElement (ob);
1199 void WriteObject_XmlSchemaAttributeGroupRef (System.Xml.Schema.XmlSchemaAttributeGroupRef ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1201 if (ob == null)
1203 if (isNullable)
1204 WriteNullTagLiteral(element, namesp);
1205 return;
1208 System.Type type = ob.GetType ();
1209 if (type == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef))
1211 else {
1212 throw CreateUnknownTypeException (ob);
1215 if (writeWrappingElem) {
1216 WriteStartElement (element, namesp, ob);
1219 if (needType) WriteXsiType("XmlSchemaAttributeGroupRef", "http://www.w3.org/2001/XMLSchema");
1221 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1223 ICollection o55 = ob.@UnhandledAttributes;
1224 if (o55 != null) {
1225 foreach (XmlAttribute o56 in o55)
1226 if (o56.NamespaceURI != xmlNamespace)
1227 WriteXmlAttribute (o56, ob);
1230 WriteAttribute ("id", "", ob.@Id);
1231 WriteAttribute ("ref", "", FromXmlQualifiedName (ob.@RefName));
1233 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1234 if (writeWrappingElem) WriteEndElement (ob);
1237 void WriteObject_XmlSchemaAnyAttribute (System.Xml.Schema.XmlSchemaAnyAttribute ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1239 if (ob == null)
1241 if (isNullable)
1242 WriteNullTagLiteral(element, namesp);
1243 return;
1246 System.Type type = ob.GetType ();
1247 if (type == typeof(System.Xml.Schema.XmlSchemaAnyAttribute))
1249 else {
1250 throw CreateUnknownTypeException (ob);
1253 if (writeWrappingElem) {
1254 WriteStartElement (element, namesp, ob);
1257 if (needType) WriteXsiType("XmlSchemaAnyAttribute", "http://www.w3.org/2001/XMLSchema");
1259 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1261 ICollection o57 = ob.@UnhandledAttributes;
1262 if (o57 != null) {
1263 foreach (XmlAttribute o58 in o57)
1264 if (o58.NamespaceURI != xmlNamespace)
1265 WriteXmlAttribute (o58, ob);
1268 WriteAttribute ("id", "", ob.@Id);
1269 WriteAttribute ("namespace", "", ob.@Namespace);
1270 if (ob.@ProcessContents != ((System.Xml.Schema.XmlSchemaContentProcessing) System.Xml.Schema.XmlSchemaContentProcessing.None)) {
1271 WriteAttribute ("processContents", "", GetEnumValue_XmlSchemaContentProcessing (ob.@ProcessContents));
1274 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1275 if (writeWrappingElem) WriteEndElement (ob);
1278 void WriteObject_XmlSchemaSequence (System.Xml.Schema.XmlSchemaSequence ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1280 if (ob == null)
1282 if (isNullable)
1283 WriteNullTagLiteral(element, namesp);
1284 return;
1287 System.Type type = ob.GetType ();
1288 if (type == typeof(System.Xml.Schema.XmlSchemaSequence))
1290 else {
1291 throw CreateUnknownTypeException (ob);
1294 if (writeWrappingElem) {
1295 WriteStartElement (element, namesp, ob);
1298 if (needType) WriteXsiType("XmlSchemaSequence", "http://www.w3.org/2001/XMLSchema");
1300 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1302 ICollection o59 = ob.@UnhandledAttributes;
1303 if (o59 != null) {
1304 foreach (XmlAttribute o60 in o59)
1305 if (o60.NamespaceURI != xmlNamespace)
1306 WriteXmlAttribute (o60, ob);
1309 WriteAttribute ("id", "", ob.@Id);
1310 WriteAttribute ("minOccurs", "", ob.@MinOccursString);
1311 WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);
1313 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1314 if (ob.@Items != null) {
1315 for (int n61 = 0; n61 < ob.@Items.Count; n61++) {
1316 if (ob.@Items[n61] == null) { }
1317 else if (ob.@Items[n61].GetType() == typeof(System.Xml.Schema.XmlSchemaSequence)) {
1318 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Items[n61]), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);
1320 else if (ob.@Items[n61].GetType() == typeof(System.Xml.Schema.XmlSchemaChoice)) {
1321 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Items[n61]), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);
1323 else if (ob.@Items[n61].GetType() == typeof(System.Xml.Schema.XmlSchemaGroupRef)) {
1324 WriteObject_XmlSchemaGroupRef (((System.Xml.Schema.XmlSchemaGroupRef) ob.@Items[n61]), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);
1326 else if (ob.@Items[n61].GetType() == typeof(System.Xml.Schema.XmlSchemaElement)) {
1327 WriteObject_XmlSchemaElement (((System.Xml.Schema.XmlSchemaElement) ob.@Items[n61]), "element", "http://www.w3.org/2001/XMLSchema", false, false, true);
1329 else if (ob.@Items[n61].GetType() == typeof(System.Xml.Schema.XmlSchemaAny)) {
1330 WriteObject_XmlSchemaAny (((System.Xml.Schema.XmlSchemaAny) ob.@Items[n61]), "any", "http://www.w3.org/2001/XMLSchema", false, false, true);
1332 else throw CreateUnknownTypeException (ob.@Items[n61]);
1335 if (writeWrappingElem) WriteEndElement (ob);
1338 void WriteObject_XmlSchemaChoice (System.Xml.Schema.XmlSchemaChoice ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1340 if (ob == null)
1342 if (isNullable)
1343 WriteNullTagLiteral(element, namesp);
1344 return;
1347 System.Type type = ob.GetType ();
1348 if (type == typeof(System.Xml.Schema.XmlSchemaChoice))
1350 else {
1351 throw CreateUnknownTypeException (ob);
1354 if (writeWrappingElem) {
1355 WriteStartElement (element, namesp, ob);
1358 if (needType) WriteXsiType("XmlSchemaChoice", "http://www.w3.org/2001/XMLSchema");
1360 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1362 ICollection o62 = ob.@UnhandledAttributes;
1363 if (o62 != null) {
1364 foreach (XmlAttribute o63 in o62)
1365 if (o63.NamespaceURI != xmlNamespace)
1366 WriteXmlAttribute (o63, ob);
1369 WriteAttribute ("id", "", ob.@Id);
1370 WriteAttribute ("minOccurs", "", ob.@MinOccursString);
1371 WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);
1373 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1374 if (ob.@Items != null) {
1375 for (int n64 = 0; n64 < ob.@Items.Count; n64++) {
1376 if (ob.@Items[n64] == null) { }
1377 else if (ob.@Items[n64].GetType() == typeof(System.Xml.Schema.XmlSchemaGroupRef)) {
1378 WriteObject_XmlSchemaGroupRef (((System.Xml.Schema.XmlSchemaGroupRef) ob.@Items[n64]), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);
1380 else if (ob.@Items[n64].GetType() == typeof(System.Xml.Schema.XmlSchemaElement)) {
1381 WriteObject_XmlSchemaElement (((System.Xml.Schema.XmlSchemaElement) ob.@Items[n64]), "element", "http://www.w3.org/2001/XMLSchema", false, false, true);
1383 else if (ob.@Items[n64].GetType() == typeof(System.Xml.Schema.XmlSchemaAny)) {
1384 WriteObject_XmlSchemaAny (((System.Xml.Schema.XmlSchemaAny) ob.@Items[n64]), "any", "http://www.w3.org/2001/XMLSchema", false, false, true);
1386 else if (ob.@Items[n64].GetType() == typeof(System.Xml.Schema.XmlSchemaSequence)) {
1387 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Items[n64]), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);
1389 else if (ob.@Items[n64].GetType() == typeof(System.Xml.Schema.XmlSchemaChoice)) {
1390 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Items[n64]), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);
1392 else throw CreateUnknownTypeException (ob.@Items[n64]);
1395 if (writeWrappingElem) WriteEndElement (ob);
1398 void WriteObject_XmlSchemaAll (System.Xml.Schema.XmlSchemaAll ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1400 if (ob == null)
1402 if (isNullable)
1403 WriteNullTagLiteral(element, namesp);
1404 return;
1407 System.Type type = ob.GetType ();
1408 if (type == typeof(System.Xml.Schema.XmlSchemaAll))
1410 else {
1411 throw CreateUnknownTypeException (ob);
1414 if (writeWrappingElem) {
1415 WriteStartElement (element, namesp, ob);
1418 if (needType) WriteXsiType("XmlSchemaAll", "http://www.w3.org/2001/XMLSchema");
1420 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1422 ICollection o65 = ob.@UnhandledAttributes;
1423 if (o65 != null) {
1424 foreach (XmlAttribute o66 in o65)
1425 if (o66.NamespaceURI != xmlNamespace)
1426 WriteXmlAttribute (o66, ob);
1429 WriteAttribute ("id", "", ob.@Id);
1430 WriteAttribute ("minOccurs", "", ob.@MinOccursString);
1431 WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);
1433 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1434 if (ob.@Items != null) {
1435 for (int n67 = 0; n67 < ob.@Items.Count; n67++) {
1436 WriteObject_XmlSchemaElement (((System.Xml.Schema.XmlSchemaElement) ob.@Items[n67]), "element", "http://www.w3.org/2001/XMLSchema", false, false, true);
1439 if (writeWrappingElem) WriteEndElement (ob);
1442 void WriteObject_XmlSchemaComplexContent (System.Xml.Schema.XmlSchemaComplexContent ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1444 if (ob == null)
1446 if (isNullable)
1447 WriteNullTagLiteral(element, namesp);
1448 return;
1451 System.Type type = ob.GetType ();
1452 if (type == typeof(System.Xml.Schema.XmlSchemaComplexContent))
1454 else {
1455 throw CreateUnknownTypeException (ob);
1458 if (writeWrappingElem) {
1459 WriteStartElement (element, namesp, ob);
1462 if (needType) WriteXsiType("XmlSchemaComplexContent", "http://www.w3.org/2001/XMLSchema");
1464 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1466 ICollection o68 = ob.@UnhandledAttributes;
1467 if (o68 != null) {
1468 foreach (XmlAttribute o69 in o68)
1469 if (o69.NamespaceURI != xmlNamespace)
1470 WriteXmlAttribute (o69, ob);
1473 WriteAttribute ("id", "", ob.@Id);
1474 WriteAttribute ("mixed", "", (ob.@IsMixed?"true":"false"));
1476 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1477 if (ob.@Content is System.Xml.Schema.XmlSchemaComplexContentExtension) {
1478 WriteObject_XmlSchemaComplexContentExtension (((System.Xml.Schema.XmlSchemaComplexContentExtension) ob.@Content), "extension", "http://www.w3.org/2001/XMLSchema", false, false, true);
1480 else if (ob.@Content is System.Xml.Schema.XmlSchemaComplexContentRestriction) {
1481 WriteObject_XmlSchemaComplexContentRestriction (((System.Xml.Schema.XmlSchemaComplexContentRestriction) ob.@Content), "restriction", "http://www.w3.org/2001/XMLSchema", false, false, true);
1483 if (writeWrappingElem) WriteEndElement (ob);
1486 void WriteObject_XmlSchemaSimpleContent (System.Xml.Schema.XmlSchemaSimpleContent ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1488 if (ob == null)
1490 if (isNullable)
1491 WriteNullTagLiteral(element, namesp);
1492 return;
1495 System.Type type = ob.GetType ();
1496 if (type == typeof(System.Xml.Schema.XmlSchemaSimpleContent))
1498 else {
1499 throw CreateUnknownTypeException (ob);
1502 if (writeWrappingElem) {
1503 WriteStartElement (element, namesp, ob);
1506 if (needType) WriteXsiType("XmlSchemaSimpleContent", "http://www.w3.org/2001/XMLSchema");
1508 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1510 ICollection o70 = ob.@UnhandledAttributes;
1511 if (o70 != null) {
1512 foreach (XmlAttribute o71 in o70)
1513 if (o71.NamespaceURI != xmlNamespace)
1514 WriteXmlAttribute (o71, ob);
1517 WriteAttribute ("id", "", ob.@Id);
1519 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1520 if (ob.@Content is System.Xml.Schema.XmlSchemaSimpleContentExtension) {
1521 WriteObject_XmlSchemaSimpleContentExtension (((System.Xml.Schema.XmlSchemaSimpleContentExtension) ob.@Content), "extension", "http://www.w3.org/2001/XMLSchema", false, false, true);
1523 else if (ob.@Content is System.Xml.Schema.XmlSchemaSimpleContentRestriction) {
1524 WriteObject_XmlSchemaSimpleContentRestriction (((System.Xml.Schema.XmlSchemaSimpleContentRestriction) ob.@Content), "restriction", "http://www.w3.org/2001/XMLSchema", false, false, true);
1526 if (writeWrappingElem) WriteEndElement (ob);
1529 void WriteObject_XmlSchemaGroupRef (System.Xml.Schema.XmlSchemaGroupRef ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1531 if (ob == null)
1533 if (isNullable)
1534 WriteNullTagLiteral(element, namesp);
1535 return;
1538 System.Type type = ob.GetType ();
1539 if (type == typeof(System.Xml.Schema.XmlSchemaGroupRef))
1541 else {
1542 throw CreateUnknownTypeException (ob);
1545 if (writeWrappingElem) {
1546 WriteStartElement (element, namesp, ob);
1549 if (needType) WriteXsiType("XmlSchemaGroupRef", "http://www.w3.org/2001/XMLSchema");
1551 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1553 ICollection o72 = ob.@UnhandledAttributes;
1554 if (o72 != null) {
1555 foreach (XmlAttribute o73 in o72)
1556 if (o73.NamespaceURI != xmlNamespace)
1557 WriteXmlAttribute (o73, ob);
1560 WriteAttribute ("id", "", ob.@Id);
1561 WriteAttribute ("minOccurs", "", ob.@MinOccursString);
1562 WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);
1563 WriteAttribute ("ref", "", FromXmlQualifiedName (ob.@RefName));
1565 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1566 if (writeWrappingElem) WriteEndElement (ob);
1569 void WriteObject_XmlSchemaXPath (System.Xml.Schema.XmlSchemaXPath ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1571 if (ob == null)
1573 if (isNullable)
1574 WriteNullTagLiteral(element, namesp);
1575 return;
1578 System.Type type = ob.GetType ();
1579 if (type == typeof(System.Xml.Schema.XmlSchemaXPath))
1581 else {
1582 throw CreateUnknownTypeException (ob);
1585 if (writeWrappingElem) {
1586 WriteStartElement (element, namesp, ob);
1589 if (needType) WriteXsiType("XmlSchemaXPath", "http://www.w3.org/2001/XMLSchema");
1591 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1593 ICollection o74 = ob.@UnhandledAttributes;
1594 if (o74 != null) {
1595 foreach (XmlAttribute o75 in o74)
1596 if (o75.NamespaceURI != xmlNamespace)
1597 WriteXmlAttribute (o75, ob);
1600 WriteAttribute ("id", "", ob.@Id);
1601 if (ob.@XPath != null) {
1602 WriteAttribute ("xpath", "", ob.@XPath);
1605 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1606 if (writeWrappingElem) WriteEndElement (ob);
1609 void WriteObject_XmlSchemaMaxLengthFacet (System.Xml.Schema.XmlSchemaMaxLengthFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1611 if (ob == null)
1613 if (isNullable)
1614 WriteNullTagLiteral(element, namesp);
1615 return;
1618 System.Type type = ob.GetType ();
1619 if (type == typeof(System.Xml.Schema.XmlSchemaMaxLengthFacet))
1621 else {
1622 throw CreateUnknownTypeException (ob);
1625 if (writeWrappingElem) {
1626 WriteStartElement (element, namesp, ob);
1629 if (needType) WriteXsiType("XmlSchemaMaxLengthFacet", "http://www.w3.org/2001/XMLSchema");
1631 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1633 ICollection o76 = ob.@UnhandledAttributes;
1634 if (o76 != null) {
1635 foreach (XmlAttribute o77 in o76)
1636 if (o77.NamespaceURI != xmlNamespace)
1637 WriteXmlAttribute (o77, ob);
1640 WriteAttribute ("id", "", ob.@Id);
1641 WriteAttribute ("value", "", ob.@Value);
1642 if (ob.@IsFixed != false) {
1643 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
1646 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1647 if (writeWrappingElem) WriteEndElement (ob);
1650 void WriteObject_XmlSchemaMinLengthFacet (System.Xml.Schema.XmlSchemaMinLengthFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1652 if (ob == null)
1654 if (isNullable)
1655 WriteNullTagLiteral(element, namesp);
1656 return;
1659 System.Type type = ob.GetType ();
1660 if (type == typeof(System.Xml.Schema.XmlSchemaMinLengthFacet))
1662 else {
1663 throw CreateUnknownTypeException (ob);
1666 if (writeWrappingElem) {
1667 WriteStartElement (element, namesp, ob);
1670 if (needType) WriteXsiType("XmlSchemaMinLengthFacet", "http://www.w3.org/2001/XMLSchema");
1672 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1674 ICollection o78 = ob.@UnhandledAttributes;
1675 if (o78 != null) {
1676 foreach (XmlAttribute o79 in o78)
1677 if (o79.NamespaceURI != xmlNamespace)
1678 WriteXmlAttribute (o79, ob);
1681 WriteAttribute ("id", "", ob.@Id);
1682 WriteAttribute ("value", "", ob.@Value);
1683 if (ob.@IsFixed != false) {
1684 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
1687 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1688 if (writeWrappingElem) WriteEndElement (ob);
1691 void WriteObject_XmlSchemaLengthFacet (System.Xml.Schema.XmlSchemaLengthFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1693 if (ob == null)
1695 if (isNullable)
1696 WriteNullTagLiteral(element, namesp);
1697 return;
1700 System.Type type = ob.GetType ();
1701 if (type == typeof(System.Xml.Schema.XmlSchemaLengthFacet))
1703 else {
1704 throw CreateUnknownTypeException (ob);
1707 if (writeWrappingElem) {
1708 WriteStartElement (element, namesp, ob);
1711 if (needType) WriteXsiType("XmlSchemaLengthFacet", "http://www.w3.org/2001/XMLSchema");
1713 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1715 ICollection o80 = ob.@UnhandledAttributes;
1716 if (o80 != null) {
1717 foreach (XmlAttribute o81 in o80)
1718 if (o81.NamespaceURI != xmlNamespace)
1719 WriteXmlAttribute (o81, ob);
1722 WriteAttribute ("id", "", ob.@Id);
1723 WriteAttribute ("value", "", ob.@Value);
1724 if (ob.@IsFixed != false) {
1725 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
1728 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1729 if (writeWrappingElem) WriteEndElement (ob);
1732 void WriteObject_XmlSchemaFractionDigitsFacet (System.Xml.Schema.XmlSchemaFractionDigitsFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1734 if (ob == null)
1736 if (isNullable)
1737 WriteNullTagLiteral(element, namesp);
1738 return;
1741 System.Type type = ob.GetType ();
1742 if (type == typeof(System.Xml.Schema.XmlSchemaFractionDigitsFacet))
1744 else {
1745 throw CreateUnknownTypeException (ob);
1748 if (writeWrappingElem) {
1749 WriteStartElement (element, namesp, ob);
1752 if (needType) WriteXsiType("XmlSchemaFractionDigitsFacet", "http://www.w3.org/2001/XMLSchema");
1754 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1756 ICollection o82 = ob.@UnhandledAttributes;
1757 if (o82 != null) {
1758 foreach (XmlAttribute o83 in o82)
1759 if (o83.NamespaceURI != xmlNamespace)
1760 WriteXmlAttribute (o83, ob);
1763 WriteAttribute ("id", "", ob.@Id);
1764 WriteAttribute ("value", "", ob.@Value);
1765 if (ob.@IsFixed != false) {
1766 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
1769 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1770 if (writeWrappingElem) WriteEndElement (ob);
1773 void WriteObject_XmlSchemaMaxInclusiveFacet (System.Xml.Schema.XmlSchemaMaxInclusiveFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1775 if (ob == null)
1777 if (isNullable)
1778 WriteNullTagLiteral(element, namesp);
1779 return;
1782 System.Type type = ob.GetType ();
1783 if (type == typeof(System.Xml.Schema.XmlSchemaMaxInclusiveFacet))
1785 else {
1786 throw CreateUnknownTypeException (ob);
1789 if (writeWrappingElem) {
1790 WriteStartElement (element, namesp, ob);
1793 if (needType) WriteXsiType("XmlSchemaMaxInclusiveFacet", "http://www.w3.org/2001/XMLSchema");
1795 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1797 ICollection o84 = ob.@UnhandledAttributes;
1798 if (o84 != null) {
1799 foreach (XmlAttribute o85 in o84)
1800 if (o85.NamespaceURI != xmlNamespace)
1801 WriteXmlAttribute (o85, ob);
1804 WriteAttribute ("id", "", ob.@Id);
1805 WriteAttribute ("value", "", ob.@Value);
1806 if (ob.@IsFixed != false) {
1807 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
1810 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1811 if (writeWrappingElem) WriteEndElement (ob);
1814 void WriteObject_XmlSchemaMaxExclusiveFacet (System.Xml.Schema.XmlSchemaMaxExclusiveFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1816 if (ob == null)
1818 if (isNullable)
1819 WriteNullTagLiteral(element, namesp);
1820 return;
1823 System.Type type = ob.GetType ();
1824 if (type == typeof(System.Xml.Schema.XmlSchemaMaxExclusiveFacet))
1826 else {
1827 throw CreateUnknownTypeException (ob);
1830 if (writeWrappingElem) {
1831 WriteStartElement (element, namesp, ob);
1834 if (needType) WriteXsiType("XmlSchemaMaxExclusiveFacet", "http://www.w3.org/2001/XMLSchema");
1836 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1838 ICollection o86 = ob.@UnhandledAttributes;
1839 if (o86 != null) {
1840 foreach (XmlAttribute o87 in o86)
1841 if (o87.NamespaceURI != xmlNamespace)
1842 WriteXmlAttribute (o87, ob);
1845 WriteAttribute ("id", "", ob.@Id);
1846 WriteAttribute ("value", "", ob.@Value);
1847 if (ob.@IsFixed != false) {
1848 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
1851 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1852 if (writeWrappingElem) WriteEndElement (ob);
1855 void WriteObject_XmlSchemaMinExclusiveFacet (System.Xml.Schema.XmlSchemaMinExclusiveFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1857 if (ob == null)
1859 if (isNullable)
1860 WriteNullTagLiteral(element, namesp);
1861 return;
1864 System.Type type = ob.GetType ();
1865 if (type == typeof(System.Xml.Schema.XmlSchemaMinExclusiveFacet))
1867 else {
1868 throw CreateUnknownTypeException (ob);
1871 if (writeWrappingElem) {
1872 WriteStartElement (element, namesp, ob);
1875 if (needType) WriteXsiType("XmlSchemaMinExclusiveFacet", "http://www.w3.org/2001/XMLSchema");
1877 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1879 ICollection o88 = ob.@UnhandledAttributes;
1880 if (o88 != null) {
1881 foreach (XmlAttribute o89 in o88)
1882 if (o89.NamespaceURI != xmlNamespace)
1883 WriteXmlAttribute (o89, ob);
1886 WriteAttribute ("id", "", ob.@Id);
1887 WriteAttribute ("value", "", ob.@Value);
1888 if (ob.@IsFixed != false) {
1889 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
1892 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1893 if (writeWrappingElem) WriteEndElement (ob);
1896 void WriteObject_XmlSchemaEnumerationFacet (System.Xml.Schema.XmlSchemaEnumerationFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1898 if (ob == null)
1900 if (isNullable)
1901 WriteNullTagLiteral(element, namesp);
1902 return;
1905 System.Type type = ob.GetType ();
1906 if (type == typeof(System.Xml.Schema.XmlSchemaEnumerationFacet))
1908 else {
1909 throw CreateUnknownTypeException (ob);
1912 if (writeWrappingElem) {
1913 WriteStartElement (element, namesp, ob);
1916 if (needType) WriteXsiType("XmlSchemaEnumerationFacet", "http://www.w3.org/2001/XMLSchema");
1918 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1920 ICollection o90 = ob.@UnhandledAttributes;
1921 if (o90 != null) {
1922 foreach (XmlAttribute o91 in o90)
1923 if (o91.NamespaceURI != xmlNamespace)
1924 WriteXmlAttribute (o91, ob);
1927 WriteAttribute ("id", "", ob.@Id);
1928 WriteAttribute ("value", "", ob.@Value);
1929 if (ob.@IsFixed != false) {
1930 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
1933 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1934 if (writeWrappingElem) WriteEndElement (ob);
1937 void WriteObject_XmlSchemaTotalDigitsFacet (System.Xml.Schema.XmlSchemaTotalDigitsFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1939 if (ob == null)
1941 if (isNullable)
1942 WriteNullTagLiteral(element, namesp);
1943 return;
1946 System.Type type = ob.GetType ();
1947 if (type == typeof(System.Xml.Schema.XmlSchemaTotalDigitsFacet))
1949 else {
1950 throw CreateUnknownTypeException (ob);
1953 if (writeWrappingElem) {
1954 WriteStartElement (element, namesp, ob);
1957 if (needType) WriteXsiType("XmlSchemaTotalDigitsFacet", "http://www.w3.org/2001/XMLSchema");
1959 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
1961 ICollection o92 = ob.@UnhandledAttributes;
1962 if (o92 != null) {
1963 foreach (XmlAttribute o93 in o92)
1964 if (o93.NamespaceURI != xmlNamespace)
1965 WriteXmlAttribute (o93, ob);
1968 WriteAttribute ("id", "", ob.@Id);
1969 WriteAttribute ("value", "", ob.@Value);
1970 if (ob.@IsFixed != false) {
1971 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
1974 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
1975 if (writeWrappingElem) WriteEndElement (ob);
1978 void WriteObject_XmlSchemaMinInclusiveFacet (System.Xml.Schema.XmlSchemaMinInclusiveFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1980 if (ob == null)
1982 if (isNullable)
1983 WriteNullTagLiteral(element, namesp);
1984 return;
1987 System.Type type = ob.GetType ();
1988 if (type == typeof(System.Xml.Schema.XmlSchemaMinInclusiveFacet))
1990 else {
1991 throw CreateUnknownTypeException (ob);
1994 if (writeWrappingElem) {
1995 WriteStartElement (element, namesp, ob);
1998 if (needType) WriteXsiType("XmlSchemaMinInclusiveFacet", "http://www.w3.org/2001/XMLSchema");
2000 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
2002 ICollection o94 = ob.@UnhandledAttributes;
2003 if (o94 != null) {
2004 foreach (XmlAttribute o95 in o94)
2005 if (o95.NamespaceURI != xmlNamespace)
2006 WriteXmlAttribute (o95, ob);
2009 WriteAttribute ("id", "", ob.@Id);
2010 WriteAttribute ("value", "", ob.@Value);
2011 if (ob.@IsFixed != false) {
2012 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
2015 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
2016 if (writeWrappingElem) WriteEndElement (ob);
2019 void WriteObject_XmlSchemaWhiteSpaceFacet (System.Xml.Schema.XmlSchemaWhiteSpaceFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2021 if (ob == null)
2023 if (isNullable)
2024 WriteNullTagLiteral(element, namesp);
2025 return;
2028 System.Type type = ob.GetType ();
2029 if (type == typeof(System.Xml.Schema.XmlSchemaWhiteSpaceFacet))
2031 else {
2032 throw CreateUnknownTypeException (ob);
2035 if (writeWrappingElem) {
2036 WriteStartElement (element, namesp, ob);
2039 if (needType) WriteXsiType("XmlSchemaWhiteSpaceFacet", "http://www.w3.org/2001/XMLSchema");
2041 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
2043 ICollection o96 = ob.@UnhandledAttributes;
2044 if (o96 != null) {
2045 foreach (XmlAttribute o97 in o96)
2046 if (o97.NamespaceURI != xmlNamespace)
2047 WriteXmlAttribute (o97, ob);
2050 WriteAttribute ("id", "", ob.@Id);
2051 WriteAttribute ("value", "", ob.@Value);
2052 if (ob.@IsFixed != false) {
2053 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
2056 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
2057 if (writeWrappingElem) WriteEndElement (ob);
2060 void WriteObject_XmlSchemaPatternFacet (System.Xml.Schema.XmlSchemaPatternFacet ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2062 if (ob == null)
2064 if (isNullable)
2065 WriteNullTagLiteral(element, namesp);
2066 return;
2069 System.Type type = ob.GetType ();
2070 if (type == typeof(System.Xml.Schema.XmlSchemaPatternFacet))
2072 else {
2073 throw CreateUnknownTypeException (ob);
2076 if (writeWrappingElem) {
2077 WriteStartElement (element, namesp, ob);
2080 if (needType) WriteXsiType("XmlSchemaPatternFacet", "http://www.w3.org/2001/XMLSchema");
2082 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
2084 ICollection o98 = ob.@UnhandledAttributes;
2085 if (o98 != null) {
2086 foreach (XmlAttribute o99 in o98)
2087 if (o99.NamespaceURI != xmlNamespace)
2088 WriteXmlAttribute (o99, ob);
2091 WriteAttribute ("id", "", ob.@Id);
2092 WriteAttribute ("value", "", ob.@Value);
2093 if (ob.@IsFixed != false) {
2094 WriteAttribute ("fixed", "", (ob.@IsFixed?"true":"false"));
2097 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
2098 if (writeWrappingElem) WriteEndElement (ob);
2101 void WriteObject_XmlSchemaContentProcessing (System.Xml.Schema.XmlSchemaContentProcessing ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2103 System.Type type = ob.GetType ();
2104 if (type == typeof(System.Xml.Schema.XmlSchemaContentProcessing))
2106 else {
2107 throw CreateUnknownTypeException (ob);
2110 if (writeWrappingElem) {
2111 WriteStartElement (element, namesp, ob);
2114 if (needType) WriteXsiType("XmlSchemaContentProcessing", "");
2116 Writer.WriteString (GetEnumValue_XmlSchemaContentProcessing (ob));
2117 if (writeWrappingElem) WriteEndElement (ob);
2120 string GetEnumValue_XmlSchemaContentProcessing (System.Xml.Schema.XmlSchemaContentProcessing val)
2122 switch (val)
2124 case System.Xml.Schema.XmlSchemaContentProcessing.Skip: return "skip";
2125 case System.Xml.Schema.XmlSchemaContentProcessing.Lax: return "lax";
2126 case System.Xml.Schema.XmlSchemaContentProcessing.Strict: return "strict";
2127 default: return ((long)val).ToString(CultureInfo.InvariantCulture);
2131 void WriteObject_XmlSchemaAny (System.Xml.Schema.XmlSchemaAny ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2133 if (ob == null)
2135 if (isNullable)
2136 WriteNullTagLiteral(element, namesp);
2137 return;
2140 System.Type type = ob.GetType ();
2141 if (type == typeof(System.Xml.Schema.XmlSchemaAny))
2143 else {
2144 throw CreateUnknownTypeException (ob);
2147 if (writeWrappingElem) {
2148 WriteStartElement (element, namesp, ob);
2151 if (needType) WriteXsiType("XmlSchemaAny", "http://www.w3.org/2001/XMLSchema");
2153 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
2155 ICollection o100 = ob.@UnhandledAttributes;
2156 if (o100 != null) {
2157 foreach (XmlAttribute o101 in o100)
2158 if (o101.NamespaceURI != xmlNamespace)
2159 WriteXmlAttribute (o101, ob);
2162 WriteAttribute ("id", "", ob.@Id);
2163 WriteAttribute ("minOccurs", "", ob.@MinOccursString);
2164 WriteAttribute ("maxOccurs", "", ob.@MaxOccursString);
2165 WriteAttribute ("namespace", "", ob.@Namespace);
2166 if (ob.@ProcessContents != ((System.Xml.Schema.XmlSchemaContentProcessing) System.Xml.Schema.XmlSchemaContentProcessing.None)) {
2167 WriteAttribute ("processContents", "", GetEnumValue_XmlSchemaContentProcessing (ob.@ProcessContents));
2170 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
2171 if (writeWrappingElem) WriteEndElement (ob);
2174 void WriteObject_XmlSchemaComplexContentExtension (System.Xml.Schema.XmlSchemaComplexContentExtension ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2176 if (ob == null)
2178 if (isNullable)
2179 WriteNullTagLiteral(element, namesp);
2180 return;
2183 System.Type type = ob.GetType ();
2184 if (type == typeof(System.Xml.Schema.XmlSchemaComplexContentExtension))
2186 else {
2187 throw CreateUnknownTypeException (ob);
2190 if (writeWrappingElem) {
2191 WriteStartElement (element, namesp, ob);
2194 if (needType) WriteXsiType("XmlSchemaComplexContentExtension", "http://www.w3.org/2001/XMLSchema");
2196 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
2198 ICollection o102 = ob.@UnhandledAttributes;
2199 if (o102 != null) {
2200 foreach (XmlAttribute o103 in o102)
2201 if (o103.NamespaceURI != xmlNamespace)
2202 WriteXmlAttribute (o103, ob);
2205 WriteAttribute ("id", "", ob.@Id);
2206 WriteAttribute ("base", "", FromXmlQualifiedName (ob.@BaseTypeName));
2208 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
2209 if (ob.@Particle is System.Xml.Schema.XmlSchemaGroupRef) {
2210 WriteObject_XmlSchemaGroupRef (((System.Xml.Schema.XmlSchemaGroupRef) ob.@Particle), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);
2212 else if (ob.@Particle is System.Xml.Schema.XmlSchemaSequence) {
2213 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Particle), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);
2215 else if (ob.@Particle is System.Xml.Schema.XmlSchemaChoice) {
2216 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Particle), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);
2218 else if (ob.@Particle is System.Xml.Schema.XmlSchemaAll) {
2219 WriteObject_XmlSchemaAll (((System.Xml.Schema.XmlSchemaAll) ob.@Particle), "all", "http://www.w3.org/2001/XMLSchema", false, false, true);
2221 if (ob.@Attributes != null) {
2222 for (int n104 = 0; n104 < ob.@Attributes.Count; n104++) {
2223 if (ob.@Attributes[n104] == null) { }
2224 else if (ob.@Attributes[n104].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {
2225 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n104]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
2227 else if (ob.@Attributes[n104].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {
2228 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n104]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);
2230 else throw CreateUnknownTypeException (ob.@Attributes[n104]);
2233 WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
2234 if (writeWrappingElem) WriteEndElement (ob);
2237 void WriteObject_XmlSchemaComplexContentRestriction (System.Xml.Schema.XmlSchemaComplexContentRestriction ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2239 if (ob == null)
2241 if (isNullable)
2242 WriteNullTagLiteral(element, namesp);
2243 return;
2246 System.Type type = ob.GetType ();
2247 if (type == typeof(System.Xml.Schema.XmlSchemaComplexContentRestriction))
2249 else {
2250 throw CreateUnknownTypeException (ob);
2253 if (writeWrappingElem) {
2254 WriteStartElement (element, namesp, ob);
2257 if (needType) WriteXsiType("XmlSchemaComplexContentRestriction", "http://www.w3.org/2001/XMLSchema");
2259 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
2261 ICollection o105 = ob.@UnhandledAttributes;
2262 if (o105 != null) {
2263 foreach (XmlAttribute o106 in o105)
2264 if (o106.NamespaceURI != xmlNamespace)
2265 WriteXmlAttribute (o106, ob);
2268 WriteAttribute ("id", "", ob.@Id);
2269 WriteAttribute ("base", "", FromXmlQualifiedName (ob.@BaseTypeName));
2271 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
2272 if (ob.@Particle is System.Xml.Schema.XmlSchemaSequence) {
2273 WriteObject_XmlSchemaSequence (((System.Xml.Schema.XmlSchemaSequence) ob.@Particle), "sequence", "http://www.w3.org/2001/XMLSchema", false, false, true);
2275 else if (ob.@Particle is System.Xml.Schema.XmlSchemaChoice) {
2276 WriteObject_XmlSchemaChoice (((System.Xml.Schema.XmlSchemaChoice) ob.@Particle), "choice", "http://www.w3.org/2001/XMLSchema", false, false, true);
2278 else if (ob.@Particle is System.Xml.Schema.XmlSchemaGroupRef) {
2279 WriteObject_XmlSchemaGroupRef (((System.Xml.Schema.XmlSchemaGroupRef) ob.@Particle), "group", "http://www.w3.org/2001/XMLSchema", false, false, true);
2281 else if (ob.@Particle is System.Xml.Schema.XmlSchemaAll) {
2282 WriteObject_XmlSchemaAll (((System.Xml.Schema.XmlSchemaAll) ob.@Particle), "all", "http://www.w3.org/2001/XMLSchema", false, false, true);
2284 if (ob.@Attributes != null) {
2285 for (int n107 = 0; n107 < ob.@Attributes.Count; n107++) {
2286 if (ob.@Attributes[n107] == null) { }
2287 else if (ob.@Attributes[n107].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {
2288 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n107]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);
2290 else if (ob.@Attributes[n107].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {
2291 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n107]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
2293 else throw CreateUnknownTypeException (ob.@Attributes[n107]);
2296 WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
2297 if (writeWrappingElem) WriteEndElement (ob);
2300 void WriteObject_XmlSchemaSimpleContentExtension (System.Xml.Schema.XmlSchemaSimpleContentExtension ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2302 if (ob == null)
2304 if (isNullable)
2305 WriteNullTagLiteral(element, namesp);
2306 return;
2309 System.Type type = ob.GetType ();
2310 if (type == typeof(System.Xml.Schema.XmlSchemaSimpleContentExtension))
2312 else {
2313 throw CreateUnknownTypeException (ob);
2316 if (writeWrappingElem) {
2317 WriteStartElement (element, namesp, ob);
2320 if (needType) WriteXsiType("XmlSchemaSimpleContentExtension", "http://www.w3.org/2001/XMLSchema");
2322 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
2324 ICollection o108 = ob.@UnhandledAttributes;
2325 if (o108 != null) {
2326 foreach (XmlAttribute o109 in o108)
2327 if (o109.NamespaceURI != xmlNamespace)
2328 WriteXmlAttribute (o109, ob);
2331 WriteAttribute ("id", "", ob.@Id);
2332 WriteAttribute ("base", "", FromXmlQualifiedName (ob.@BaseTypeName));
2334 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
2335 if (ob.@Attributes != null) {
2336 for (int n110 = 0; n110 < ob.@Attributes.Count; n110++) {
2337 if (ob.@Attributes[n110] == null) { }
2338 else if (ob.@Attributes[n110].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {
2339 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n110]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);
2341 else if (ob.@Attributes[n110].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {
2342 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n110]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
2344 else throw CreateUnknownTypeException (ob.@Attributes[n110]);
2347 WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
2348 if (writeWrappingElem) WriteEndElement (ob);
2351 void WriteObject_XmlSchemaSimpleContentRestriction (System.Xml.Schema.XmlSchemaSimpleContentRestriction ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2353 if (ob == null)
2355 if (isNullable)
2356 WriteNullTagLiteral(element, namesp);
2357 return;
2360 System.Type type = ob.GetType ();
2361 if (type == typeof(System.Xml.Schema.XmlSchemaSimpleContentRestriction))
2363 else {
2364 throw CreateUnknownTypeException (ob);
2367 if (writeWrappingElem) {
2368 WriteStartElement (element, namesp, ob);
2371 if (needType) WriteXsiType("XmlSchemaSimpleContentRestriction", "http://www.w3.org/2001/XMLSchema");
2373 WriteNamespaceDeclarations ((XmlSerializerNamespaces) ob.@Namespaces);
2375 ICollection o111 = ob.@UnhandledAttributes;
2376 if (o111 != null) {
2377 foreach (XmlAttribute o112 in o111)
2378 if (o112.NamespaceURI != xmlNamespace)
2379 WriteXmlAttribute (o112, ob);
2382 WriteAttribute ("id", "", ob.@Id);
2383 WriteAttribute ("base", "", FromXmlQualifiedName (ob.@BaseTypeName));
2385 WriteObject_XmlSchemaAnnotation (ob.@Annotation, "annotation", "http://www.w3.org/2001/XMLSchema", false, false, true);
2386 WriteObject_XmlSchemaSimpleType (ob.@BaseType, "simpleType", "http://www.w3.org/2001/XMLSchema", false, false, true);
2387 if (ob.@Facets != null) {
2388 for (int n113 = 0; n113 < ob.@Facets.Count; n113++) {
2389 if (ob.@Facets[n113] == null) { }
2390 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaEnumerationFacet)) {
2391 WriteObject_XmlSchemaEnumerationFacet (((System.Xml.Schema.XmlSchemaEnumerationFacet) ob.@Facets[n113]), "enumeration", "http://www.w3.org/2001/XMLSchema", false, false, true);
2393 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxLengthFacet)) {
2394 WriteObject_XmlSchemaMaxLengthFacet (((System.Xml.Schema.XmlSchemaMaxLengthFacet) ob.@Facets[n113]), "maxLength", "http://www.w3.org/2001/XMLSchema", false, false, true);
2396 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMinLengthFacet)) {
2397 WriteObject_XmlSchemaMinLengthFacet (((System.Xml.Schema.XmlSchemaMinLengthFacet) ob.@Facets[n113]), "minLength", "http://www.w3.org/2001/XMLSchema", false, false, true);
2399 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaLengthFacet)) {
2400 WriteObject_XmlSchemaLengthFacet (((System.Xml.Schema.XmlSchemaLengthFacet) ob.@Facets[n113]), "length", "http://www.w3.org/2001/XMLSchema", false, false, true);
2402 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaFractionDigitsFacet)) {
2403 WriteObject_XmlSchemaFractionDigitsFacet (((System.Xml.Schema.XmlSchemaFractionDigitsFacet) ob.@Facets[n113]), "fractionDigits", "http://www.w3.org/2001/XMLSchema", false, false, true);
2405 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaTotalDigitsFacet)) {
2406 WriteObject_XmlSchemaTotalDigitsFacet (((System.Xml.Schema.XmlSchemaTotalDigitsFacet) ob.@Facets[n113]), "totalDigits", "http://www.w3.org/2001/XMLSchema", false, false, true);
2408 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxInclusiveFacet)) {
2409 WriteObject_XmlSchemaMaxInclusiveFacet (((System.Xml.Schema.XmlSchemaMaxInclusiveFacet) ob.@Facets[n113]), "maxInclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);
2411 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMaxExclusiveFacet)) {
2412 WriteObject_XmlSchemaMaxExclusiveFacet (((System.Xml.Schema.XmlSchemaMaxExclusiveFacet) ob.@Facets[n113]), "maxExclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);
2414 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMinInclusiveFacet)) {
2415 WriteObject_XmlSchemaMinInclusiveFacet (((System.Xml.Schema.XmlSchemaMinInclusiveFacet) ob.@Facets[n113]), "minInclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);
2417 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaMinExclusiveFacet)) {
2418 WriteObject_XmlSchemaMinExclusiveFacet (((System.Xml.Schema.XmlSchemaMinExclusiveFacet) ob.@Facets[n113]), "minExclusive", "http://www.w3.org/2001/XMLSchema", false, false, true);
2420 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaWhiteSpaceFacet)) {
2421 WriteObject_XmlSchemaWhiteSpaceFacet (((System.Xml.Schema.XmlSchemaWhiteSpaceFacet) ob.@Facets[n113]), "whiteSpace", "http://www.w3.org/2001/XMLSchema", false, false, true);
2423 else if (ob.@Facets[n113].GetType() == typeof(System.Xml.Schema.XmlSchemaPatternFacet)) {
2424 WriteObject_XmlSchemaPatternFacet (((System.Xml.Schema.XmlSchemaPatternFacet) ob.@Facets[n113]), "pattern", "http://www.w3.org/2001/XMLSchema", false, false, true);
2426 else throw CreateUnknownTypeException (ob.@Facets[n113]);
2429 if (ob.@Attributes != null) {
2430 for (int n114 = 0; n114 < ob.@Attributes.Count; n114++) {
2431 if (ob.@Attributes[n114] == null) { }
2432 else if (ob.@Attributes[n114].GetType() == typeof(System.Xml.Schema.XmlSchemaAttributeGroupRef)) {
2433 WriteObject_XmlSchemaAttributeGroupRef (((System.Xml.Schema.XmlSchemaAttributeGroupRef) ob.@Attributes[n114]), "attributeGroup", "http://www.w3.org/2001/XMLSchema", false, false, true);
2435 else if (ob.@Attributes[n114].GetType() == typeof(System.Xml.Schema.XmlSchemaAttribute)) {
2436 WriteObject_XmlSchemaAttribute (((System.Xml.Schema.XmlSchemaAttribute) ob.@Attributes[n114]), "attribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
2438 else throw CreateUnknownTypeException (ob.@Attributes[n114]);
2441 WriteObject_XmlSchemaAnyAttribute (ob.@AnyAttribute, "anyAttribute", "http://www.w3.org/2001/XMLSchema", false, false, true);
2442 if (writeWrappingElem) WriteEndElement (ob);
2445 protected override void InitCallbacks ()