Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlSchemaInference.cs
Go to the documentation of this file.
2
3namespace System.Xml.Schema;
4
5public sealed class XmlSchemaInference
6{
7 public enum InferenceOption
8 {
11 }
12
13 internal static XmlQualifiedName ST_boolean = new XmlQualifiedName("boolean", "http://www.w3.org/2001/XMLSchema");
14
15 internal static XmlQualifiedName ST_byte = new XmlQualifiedName("byte", "http://www.w3.org/2001/XMLSchema");
16
17 internal static XmlQualifiedName ST_unsignedByte = new XmlQualifiedName("unsignedByte", "http://www.w3.org/2001/XMLSchema");
18
19 internal static XmlQualifiedName ST_short = new XmlQualifiedName("short", "http://www.w3.org/2001/XMLSchema");
20
21 internal static XmlQualifiedName ST_unsignedShort = new XmlQualifiedName("unsignedShort", "http://www.w3.org/2001/XMLSchema");
22
23 internal static XmlQualifiedName ST_int = new XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema");
24
25 internal static XmlQualifiedName ST_unsignedInt = new XmlQualifiedName("unsignedInt", "http://www.w3.org/2001/XMLSchema");
26
27 internal static XmlQualifiedName ST_long = new XmlQualifiedName("long", "http://www.w3.org/2001/XMLSchema");
28
29 internal static XmlQualifiedName ST_unsignedLong = new XmlQualifiedName("unsignedLong", "http://www.w3.org/2001/XMLSchema");
30
31 internal static XmlQualifiedName ST_integer = new XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema");
32
33 internal static XmlQualifiedName ST_decimal = new XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema");
34
35 internal static XmlQualifiedName ST_float = new XmlQualifiedName("float", "http://www.w3.org/2001/XMLSchema");
36
37 internal static XmlQualifiedName ST_double = new XmlQualifiedName("double", "http://www.w3.org/2001/XMLSchema");
38
39 internal static XmlQualifiedName ST_duration = new XmlQualifiedName("duration", "http://www.w3.org/2001/XMLSchema");
40
41 internal static XmlQualifiedName ST_dateTime = new XmlQualifiedName("dateTime", "http://www.w3.org/2001/XMLSchema");
42
43 internal static XmlQualifiedName ST_time = new XmlQualifiedName("time", "http://www.w3.org/2001/XMLSchema");
44
45 internal static XmlQualifiedName ST_date = new XmlQualifiedName("date", "http://www.w3.org/2001/XMLSchema");
46
47 internal static XmlQualifiedName ST_gYearMonth = new XmlQualifiedName("gYearMonth", "http://www.w3.org/2001/XMLSchema");
48
49 internal static XmlQualifiedName ST_string = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
50
51 internal static XmlQualifiedName ST_anySimpleType = new XmlQualifiedName("anySimpleType", "http://www.w3.org/2001/XMLSchema");
52
58
60
62
63 private XmlReader _xtr;
64
65 private readonly NameTable _nametable;
66
67 private string _targetNamespace;
68
70
71 private readonly ArrayList _schemaList;
72
74
76
78 {
79 get
80 {
81 return _occurrence;
82 }
83 set
84 {
86 }
87 }
88
90 {
91 get
92 {
93 return _typeInference;
94 }
95 set
96 {
98 }
99 }
100
102 {
103 _nametable = new NameTable();
105 _namespaceManager.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
106 _schemaList = new ArrayList();
107 }
108
113
115 {
116 if (schemas == null)
117 {
118 schemas = new XmlSchemaSet(_nametable);
119 }
120 return InferSchema1(instanceDocument, schemas);
121 }
122
124 {
125 if (instanceDocument == null)
126 {
127 throw new ArgumentNullException("instanceDocument");
128 }
129 _rootSchema = null;
131 schemas.Compile();
132 _schemaSet = schemas;
133 while (_xtr.NodeType != XmlNodeType.Element && _xtr.Read())
134 {
135 }
136 if (_xtr.NodeType == XmlNodeType.Element)
137 {
139 if (_xtr.NamespaceURI == "http://www.w3.org/2001/XMLSchema")
140 {
142 }
143 XmlSchemaElement xse = null;
144 foreach (XmlSchemaElement value in schemas.GlobalElements.Values)
145 {
146 if (value.Name == _xtr.LocalName && value.QualifiedName.Namespace == _xtr.NamespaceURI)
147 {
149 xse = value;
150 break;
151 }
152 }
153 if (_rootSchema == null)
154 {
156 }
157 else
158 {
160 }
161 foreach (string item in _namespaceManager)
162 {
163 if (!item.Equals("xml") && !item.Equals("xmlns"))
164 {
166 if (text2.Length != 0)
167 {
169 }
170 }
171 }
172 schemas.Reprocess(_rootSchema);
173 schemas.Compile();
174 return schemas;
175 }
177 }
178
180 {
181 if (childURI == "http://www.w3.org/2001/XMLSchema")
182 {
184 }
186 int iTypeFlags = -1;
188 XmlSchema xmlSchema = null;
189 bool flag = true;
190 ICollection attributes;
192 if (compiledAttributes.Count > 0)
193 {
194 attributes = compiledAttributes.Values;
196 }
197 else
198 {
199 attributes = addLocation;
200 collection = null;
201 }
202 if (childURI == "http://www.w3.org/XML/1998/namespace")
203 {
205 xmlSchemaAttribute3 = FindAttributeRef(attributes, localName, childURI);
206 if (xmlSchemaAttribute3 == null && collection != null)
207 {
209 }
210 if (xmlSchemaAttribute3 == null)
211 {
214 if (bCreatingNewType && Occurrence == InferenceOption.Restricted)
215 {
217 }
218 else
219 {
221 }
223 }
225 }
226 else
227 {
228 if (childURI.Length == 0)
229 {
231 flag = false;
232 }
233 else if (childURI != null && !_schemaSet.Contains(childURI))
234 {
235 xmlSchema = new XmlSchema();
238 if (childURI.Length != 0)
239 {
241 }
243 if (prefix.Length != 0 && !string.Equals(prefix, "xml", StringComparison.OrdinalIgnoreCase))
244 {
246 }
247 }
248 else if (_schemaSet.Schemas(childURI) is ArrayList { Count: >0 } arrayList)
249 {
251 }
252 if (childURI.Length != 0)
253 {
255 xmlSchemaAttribute4 = FindAttributeRef(attributes, localName, childURI);
256 if (xmlSchemaAttribute4 == null && collection != null)
257 {
259 }
260 if (xmlSchemaAttribute4 == null)
261 {
264 if (bCreatingNewType && Occurrence == InferenceOption.Restricted)
265 {
267 }
268 else
269 {
271 }
273 }
275 xmlSchemaAttribute = FindAttribute(xmlSchema.Items, localName);
276 if (xmlSchemaAttribute == null)
277 {
279 xmlSchemaAttribute.Name = localName;
282 xmlSchema.Items.Add(xmlSchemaAttribute);
283 }
284 else
285 {
286 if (xmlSchemaAttribute.Parent == null)
287 {
288 iTypeFlags = xmlSchemaAttribute.LineNumber;
289 }
290 else
291 {
294 }
297 }
298 }
299 else
300 {
301 xmlSchemaAttribute = FindAttribute(attributes, localName);
302 if (xmlSchemaAttribute == null && collection != null)
303 {
305 }
306 if (xmlSchemaAttribute == null)
307 {
309 xmlSchemaAttribute.Name = localName;
312 if (bCreatingNewType && Occurrence == InferenceOption.Restricted)
313 {
315 }
316 else
317 {
319 }
321 if (xmlSchema.AttributeFormDefault != XmlSchemaForm.Unqualified)
322 {
324 }
325 }
326 else
327 {
328 if (xmlSchemaAttribute.Parent == null)
329 {
330 iTypeFlags = xmlSchemaAttribute.LineNumber;
331 }
332 else
333 {
336 }
339 }
341 }
342 }
343 string @namespace = null;
344 if (flag && childURI != parentSchema.TargetNamespace)
345 {
346 for (int i = 0; i < parentSchema.Includes.Count; i++)
347 {
348 if (parentSchema.Includes[i] is XmlSchemaImport xmlSchemaImport && xmlSchemaImport.Namespace == childURI)
349 {
350 flag = false;
351 }
352 }
353 if (flag)
354 {
355 XmlSchemaImport xmlSchemaImport2 = new XmlSchemaImport();
356 xmlSchemaImport2.Schema = xmlSchema;
357 if (childURI.Length != 0)
358 {
359 @namespace = childURI;
360 }
361 xmlSchemaImport2.Namespace = @namespace;
362 parentSchema.Includes.Add(xmlSchemaImport2);
363 }
364 }
365 return xmlSchemaAttribute2;
366 }
367
368 private XmlSchema CreateXmlSchema(string targetNS)
369 {
370 XmlSchema xmlSchema = new XmlSchema();
371 xmlSchema.AttributeFormDefault = XmlSchemaForm.Unqualified;
372 xmlSchema.ElementFormDefault = XmlSchemaForm.Qualified;
373 xmlSchema.TargetNamespace = targetNS;
374 _schemaSet.Add(xmlSchema);
375 return xmlSchema;
376 }
377
378 private XmlSchemaElement AddElement(string localName, string prefix, string childURI, XmlSchema parentSchema, XmlSchemaObjectCollection addLocation, int positionWithinCollection)
379 {
380 if (childURI == "http://www.w3.org/2001/XMLSchema")
381 {
383 }
384 XmlSchemaElement xmlSchemaElement = null;
385 XmlSchemaElement xmlSchemaElement2 = xmlSchemaElement;
386 XmlSchema parentSchema2 = null;
387 bool bCreatingNewType = true;
388 if (childURI == string.Empty)
389 {
390 childURI = null;
391 }
392 if (parentSchema != null && childURI == parentSchema.TargetNamespace)
393 {
394 xmlSchemaElement = new XmlSchemaElement();
395 xmlSchemaElement.Name = localName;
396 parentSchema2 = parentSchema;
397 if (parentSchema2.ElementFormDefault != XmlSchemaForm.Qualified && addLocation != null)
398 {
399 xmlSchemaElement.Form = XmlSchemaForm.Qualified;
400 }
401 }
402 else if (_schemaSet.Contains(childURI))
403 {
404 xmlSchemaElement = FindGlobalElement(childURI, localName, out parentSchema2);
405 if (xmlSchemaElement == null)
406 {
407 if (_schemaSet.Schemas(childURI) is ArrayList { Count: >0 } arrayList)
408 {
409 parentSchema2 = arrayList[0] as XmlSchema;
410 }
411 xmlSchemaElement = new XmlSchemaElement();
412 xmlSchemaElement.Name = localName;
413 parentSchema2.Items.Add(xmlSchemaElement);
414 }
415 else
416 {
417 bCreatingNewType = false;
418 }
419 }
420 else
421 {
422 parentSchema2 = CreateXmlSchema(childURI);
423 if (prefix.Length != 0)
424 {
425 _namespaceManager.AddNamespace(prefix, childURI);
426 }
427 xmlSchemaElement = new XmlSchemaElement();
428 xmlSchemaElement.Name = localName;
429 parentSchema2.Items.Add(xmlSchemaElement);
430 }
431 if (parentSchema == null)
432 {
433 parentSchema = parentSchema2;
434 _rootSchema = parentSchema;
435 }
436 if (childURI != parentSchema.TargetNamespace)
437 {
438 bool flag = true;
439 for (int i = 0; i < parentSchema.Includes.Count; i++)
440 {
441 if (parentSchema.Includes[i] is XmlSchemaImport xmlSchemaImport && xmlSchemaImport.Namespace == childURI)
442 {
443 flag = false;
444 }
445 }
446 if (flag)
447 {
448 XmlSchemaImport xmlSchemaImport2 = new XmlSchemaImport();
449 xmlSchemaImport2.Schema = parentSchema2;
450 xmlSchemaImport2.Namespace = childURI;
451 parentSchema.Includes.Add(xmlSchemaImport2);
452 }
453 }
454 xmlSchemaElement2 = xmlSchemaElement;
455 if (addLocation != null)
456 {
457 if (childURI == parentSchema.TargetNamespace)
458 {
459 if (Occurrence == InferenceOption.Relaxed)
460 {
461 xmlSchemaElement.MinOccurs = 0m;
462 }
463 if (positionWithinCollection == -1)
464 {
465 positionWithinCollection = addLocation.Add(xmlSchemaElement);
466 }
467 else
468 {
469 addLocation.Insert(positionWithinCollection, xmlSchemaElement);
470 }
471 }
472 else
473 {
474 XmlSchemaElement xmlSchemaElement3 = new XmlSchemaElement();
475 xmlSchemaElement3.RefName = new XmlQualifiedName(localName, childURI);
476 if (Occurrence == InferenceOption.Relaxed)
477 {
478 xmlSchemaElement3.MinOccurs = 0m;
479 }
480 if (positionWithinCollection == -1)
481 {
482 positionWithinCollection = addLocation.Add(xmlSchemaElement3);
483 }
484 else
485 {
486 addLocation.Insert(positionWithinCollection, xmlSchemaElement3);
487 }
488 xmlSchemaElement2 = xmlSchemaElement3;
489 }
490 }
491 InferElement(xmlSchemaElement, bCreatingNewType, parentSchema2);
492 return xmlSchemaElement2;
493 }
494
495 internal void InferElement(XmlSchemaElement xse, bool bCreatingNewType, XmlSchema parentSchema)
496 {
497 bool isEmptyElement = _xtr.IsEmptyElement;
498 int lastUsedSeqItem = -1;
499 Hashtable hashtable = new Hashtable();
500 XmlSchemaType effectiveSchemaType = GetEffectiveSchemaType(xse, bCreatingNewType);
501 XmlSchemaComplexType xmlSchemaComplexType = effectiveSchemaType as XmlSchemaComplexType;
502 if (_xtr.MoveToFirstAttribute())
503 {
504 ProcessAttributes(ref xse, effectiveSchemaType, bCreatingNewType, parentSchema);
505 }
506 else if (!bCreatingNewType && xmlSchemaComplexType != null)
507 {
508 MakeExistingAttributesOptional(xmlSchemaComplexType, null);
509 }
510 if (xmlSchemaComplexType == null || xmlSchemaComplexType == XmlSchemaComplexType.AnyType)
511 {
512 xmlSchemaComplexType = xse.SchemaType as XmlSchemaComplexType;
513 }
514 if (isEmptyElement)
515 {
516 if (!bCreatingNewType)
517 {
518 if (xmlSchemaComplexType != null)
519 {
520 if (xmlSchemaComplexType.Particle != null)
521 {
522 xmlSchemaComplexType.Particle.MinOccurs = 0m;
523 }
524 else if (xmlSchemaComplexType.ContentModel != null)
525 {
526 XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension = CheckSimpleContentExtension(xmlSchemaComplexType);
527 xmlSchemaSimpleContentExtension.BaseTypeName = ST_string;
528 xmlSchemaSimpleContentExtension.LineNumber = 262144;
529 }
530 }
531 else if (!xse.SchemaTypeName.IsEmpty)
532 {
533 xse.LineNumber = 262144;
534 xse.SchemaTypeName = ST_string;
535 }
536 }
537 else
538 {
539 xse.LineNumber = 262144;
540 }
541 return;
542 }
543 bool flag = false;
544 do
545 {
546 _xtr.Read();
547 if (_xtr.NodeType == XmlNodeType.Whitespace)
548 {
549 flag = true;
550 }
551 if (_xtr.NodeType == XmlNodeType.EntityReference)
552 {
554 }
555 }
556 while (!_xtr.EOF && _xtr.NodeType != XmlNodeType.EndElement && _xtr.NodeType != XmlNodeType.CDATA && _xtr.NodeType != XmlNodeType.Element && _xtr.NodeType != XmlNodeType.Text);
557 if (_xtr.NodeType == XmlNodeType.EndElement)
558 {
559 if (flag)
560 {
561 if (xmlSchemaComplexType != null)
562 {
563 if (xmlSchemaComplexType.ContentModel != null)
564 {
565 XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension2 = CheckSimpleContentExtension(xmlSchemaComplexType);
566 xmlSchemaSimpleContentExtension2.BaseTypeName = ST_string;
567 xmlSchemaSimpleContentExtension2.LineNumber = 262144;
568 }
569 else if (bCreatingNewType)
570 {
571 XmlSchemaSimpleContent xmlSchemaSimpleContent = (XmlSchemaSimpleContent)(xmlSchemaComplexType.ContentModel = new XmlSchemaSimpleContent());
572 XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension3 = (XmlSchemaSimpleContentExtension)(xmlSchemaSimpleContent.Content = new XmlSchemaSimpleContentExtension());
573 MoveAttributes(xmlSchemaComplexType, xmlSchemaSimpleContentExtension3, bCreatingNewType);
574 xmlSchemaSimpleContentExtension3.BaseTypeName = ST_string;
575 xmlSchemaSimpleContentExtension3.LineNumber = 262144;
576 }
577 else
578 {
579 xmlSchemaComplexType.IsMixed = true;
580 }
581 }
582 else
583 {
584 xse.SchemaTypeName = ST_string;
585 xse.LineNumber = 262144;
586 }
587 }
588 if (bCreatingNewType)
589 {
590 xse.LineNumber = 262144;
591 }
592 else if (xmlSchemaComplexType != null)
593 {
594 if (xmlSchemaComplexType.Particle != null)
595 {
596 xmlSchemaComplexType.Particle.MinOccurs = 0m;
597 }
598 else if (xmlSchemaComplexType.ContentModel != null)
599 {
600 XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension4 = CheckSimpleContentExtension(xmlSchemaComplexType);
601 xmlSchemaSimpleContentExtension4.BaseTypeName = ST_string;
602 xmlSchemaSimpleContentExtension4.LineNumber = 262144;
603 }
604 }
605 else if (!xse.SchemaTypeName.IsEmpty)
606 {
607 xse.LineNumber = 262144;
608 xse.SchemaTypeName = ST_string;
609 }
610 return;
611 }
612 int num = 0;
613 bool flag2 = false;
614 while (!_xtr.EOF && _xtr.NodeType != XmlNodeType.EndElement)
615 {
616 bool flag3 = false;
617 num++;
618 if (_xtr.NodeType == XmlNodeType.Text || _xtr.NodeType == XmlNodeType.CDATA)
619 {
620 if (xmlSchemaComplexType != null)
621 {
622 if (xmlSchemaComplexType.Particle != null)
623 {
624 xmlSchemaComplexType.IsMixed = true;
625 if (num == 1)
626 {
627 do
628 {
629 _xtr.Read();
630 }
631 while (!_xtr.EOF && (_xtr.NodeType == XmlNodeType.CDATA || _xtr.NodeType == XmlNodeType.Text || _xtr.NodeType == XmlNodeType.Comment || _xtr.NodeType == XmlNodeType.ProcessingInstruction || _xtr.NodeType == XmlNodeType.Whitespace || _xtr.NodeType == XmlNodeType.SignificantWhitespace || _xtr.NodeType == XmlNodeType.XmlDeclaration));
632 flag3 = true;
633 if (_xtr.NodeType == XmlNodeType.EndElement)
634 {
635 xmlSchemaComplexType.Particle.MinOccurs = 0m;
636 }
637 }
638 }
639 else if (xmlSchemaComplexType.ContentModel != null)
640 {
641 XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension5 = CheckSimpleContentExtension(xmlSchemaComplexType);
642 if (_xtr.NodeType == XmlNodeType.Text && num == 1)
643 {
644 int num2 = -1;
645 if (xse.Parent == null)
646 {
647 num2 = xmlSchemaSimpleContentExtension5.LineNumber;
648 }
649 else
650 {
651 num2 = GetSchemaType(xmlSchemaSimpleContentExtension5.BaseTypeName);
652 xse.Parent = null;
653 }
654 xmlSchemaSimpleContentExtension5.BaseTypeName = RefineSimpleType(_xtr.Value, ref num2);
655 xmlSchemaSimpleContentExtension5.LineNumber = num2;
656 }
657 else
658 {
659 xmlSchemaSimpleContentExtension5.BaseTypeName = ST_string;
660 xmlSchemaSimpleContentExtension5.LineNumber = 262144;
661 }
662 }
663 else
664 {
665 XmlSchemaSimpleContent xmlSchemaSimpleContent2 = (XmlSchemaSimpleContent)(xmlSchemaComplexType.ContentModel = new XmlSchemaSimpleContent());
666 XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension6 = (XmlSchemaSimpleContentExtension)(xmlSchemaSimpleContent2.Content = new XmlSchemaSimpleContentExtension());
667 MoveAttributes(xmlSchemaComplexType, xmlSchemaSimpleContentExtension6, bCreatingNewType);
668 if (_xtr.NodeType == XmlNodeType.Text)
669 {
670 int iTypeFlags = (bCreatingNewType ? (-1) : 262144);
671 xmlSchemaSimpleContentExtension6.BaseTypeName = RefineSimpleType(_xtr.Value, ref iTypeFlags);
672 xmlSchemaSimpleContentExtension6.LineNumber = iTypeFlags;
673 }
674 else
675 {
676 xmlSchemaSimpleContentExtension6.BaseTypeName = ST_string;
677 xmlSchemaSimpleContentExtension6.LineNumber = 262144;
678 }
679 }
680 }
681 else if (num > 1)
682 {
683 xse.SchemaTypeName = ST_string;
684 xse.LineNumber = 262144;
685 }
686 else
687 {
688 int iTypeFlags2 = -1;
689 if (bCreatingNewType)
690 {
691 if (_xtr.NodeType == XmlNodeType.Text)
692 {
693 xse.SchemaTypeName = RefineSimpleType(_xtr.Value, ref iTypeFlags2);
694 xse.LineNumber = iTypeFlags2;
695 }
696 else
697 {
698 xse.SchemaTypeName = ST_string;
699 xse.LineNumber = 262144;
700 }
701 }
702 else if (_xtr.NodeType == XmlNodeType.Text)
703 {
704 if (xse.Parent == null)
705 {
706 iTypeFlags2 = xse.LineNumber;
707 }
708 else
709 {
710 iTypeFlags2 = GetSchemaType(xse.SchemaTypeName);
711 if (iTypeFlags2 == -1 && xse.LineNumber == 262144)
712 {
713 iTypeFlags2 = 262144;
714 }
715 xse.Parent = null;
716 }
717 xse.SchemaTypeName = RefineSimpleType(_xtr.Value, ref iTypeFlags2);
718 xse.LineNumber = iTypeFlags2;
719 }
720 else
721 {
722 xse.SchemaTypeName = ST_string;
723 xse.LineNumber = 262144;
724 }
725 }
726 }
727 else if (_xtr.NodeType == XmlNodeType.Element)
728 {
730 bool setMaxoccurs = false;
731 if (hashtable.Contains(key))
732 {
733 setMaxoccurs = true;
734 }
735 else
736 {
737 hashtable.Add(key, null);
738 }
739 if (xmlSchemaComplexType == null)
740 {
741 xmlSchemaComplexType = (XmlSchemaComplexType)(xse.SchemaType = new XmlSchemaComplexType());
742 if (!xse.SchemaTypeName.IsEmpty)
743 {
744 xmlSchemaComplexType.IsMixed = true;
745 xse.SchemaTypeName = XmlQualifiedName.Empty;
746 }
747 }
748 if (xmlSchemaComplexType.ContentModel != null)
749 {
750 XmlSchemaSimpleContentExtension scExtension = CheckSimpleContentExtension(xmlSchemaComplexType);
751 MoveAttributes(scExtension, xmlSchemaComplexType);
752 xmlSchemaComplexType.ContentModel = null;
753 xmlSchemaComplexType.IsMixed = true;
754 if (xmlSchemaComplexType.Particle != null)
755 {
757 }
758 xmlSchemaComplexType.Particle = new XmlSchemaSequence();
759 flag2 = true;
760 AddElement(_xtr.LocalName, _xtr.Prefix, _xtr.NamespaceURI, parentSchema, ((XmlSchemaSequence)xmlSchemaComplexType.Particle).Items, -1);
761 lastUsedSeqItem = 0;
762 if (!bCreatingNewType)
763 {
764 xmlSchemaComplexType.Particle.MinOccurs = 0m;
765 }
766 }
767 else if (xmlSchemaComplexType.Particle == null)
768 {
769 xmlSchemaComplexType.Particle = new XmlSchemaSequence();
770 flag2 = true;
771 AddElement(_xtr.LocalName, _xtr.Prefix, _xtr.NamespaceURI, parentSchema, ((XmlSchemaSequence)xmlSchemaComplexType.Particle).Items, -1);
772 if (!bCreatingNewType)
773 {
774 ((XmlSchemaSequence)xmlSchemaComplexType.Particle).MinOccurs = 0m;
775 }
776 lastUsedSeqItem = 0;
777 }
778 else
779 {
780 bool bParticleChanged = false;
781 FindMatchingElement(bCreatingNewType || flag2, _xtr, xmlSchemaComplexType, ref lastUsedSeqItem, ref bParticleChanged, parentSchema, setMaxoccurs);
782 }
783 }
784 else if (_xtr.NodeType == XmlNodeType.Text)
785 {
786 if (xmlSchemaComplexType == null)
787 {
789 }
790 xmlSchemaComplexType.IsMixed = true;
791 }
792 do
793 {
794 if (_xtr.NodeType == XmlNodeType.EntityReference)
795 {
797 }
798 if (!flag3)
799 {
800 _xtr.Read();
801 }
802 else
803 {
804 flag3 = false;
805 }
806 }
807 while (!_xtr.EOF && _xtr.NodeType != XmlNodeType.EndElement && _xtr.NodeType != XmlNodeType.CDATA && _xtr.NodeType != XmlNodeType.Element && _xtr.NodeType != XmlNodeType.Text);
808 }
809 if (lastUsedSeqItem == -1)
810 {
811 return;
812 }
813 while (++lastUsedSeqItem < ((XmlSchemaSequence)xmlSchemaComplexType.Particle).Items.Count)
814 {
815 if (((XmlSchemaSequence)xmlSchemaComplexType.Particle).Items[lastUsedSeqItem].GetType() != typeof(XmlSchemaElement))
816 {
818 }
819 XmlSchemaElement xmlSchemaElement = (XmlSchemaElement)((XmlSchemaSequence)xmlSchemaComplexType.Particle).Items[lastUsedSeqItem];
820 xmlSchemaElement.MinOccurs = 0m;
821 }
822 }
823
825 {
826 if (!(ct.ContentModel is XmlSchemaSimpleContent xmlSchemaSimpleContent))
827 {
829 }
830 if (!(xmlSchemaSimpleContent.Content is XmlSchemaSimpleContentExtension result))
831 {
833 }
834 return result;
835 }
836
837 private XmlSchemaType GetEffectiveSchemaType(XmlSchemaElement elem, bool bCreatingNewType)
838 {
839 XmlSchemaType xmlSchemaType = null;
840 if (!bCreatingNewType && elem.ElementSchemaType != null)
841 {
842 xmlSchemaType = elem.ElementSchemaType;
843 }
844 else if (elem.SchemaType != null)
845 {
846 xmlSchemaType = elem.SchemaType;
847 }
848 else if (elem.SchemaTypeName != XmlQualifiedName.Empty)
849 {
850 xmlSchemaType = _schemaSet.GlobalTypes[elem.SchemaTypeName] as XmlSchemaType;
851 if (xmlSchemaType == null)
852 {
854 }
855 if (xmlSchemaType == null)
856 {
858 }
859 }
860 return xmlSchemaType;
861 }
862
863 internal XmlSchemaElement FindMatchingElement(bool bCreatingNewType, XmlReader xtr, XmlSchemaComplexType ct, ref int lastUsedSeqItem, ref bool bParticleChanged, XmlSchema parentSchema, bool setMaxoccurs)
864 {
865 if (xtr.NamespaceURI == "http://www.w3.org/2001/XMLSchema")
866 {
868 }
869 bool flag = lastUsedSeqItem == -1;
870 XmlSchemaObjectCollection xmlSchemaObjectCollection = new XmlSchemaObjectCollection();
871 if (ct.Particle.GetType() == typeof(XmlSchemaSequence))
872 {
873 string text = xtr.NamespaceURI;
874 if (text.Length == 0)
875 {
876 text = null;
877 }
878 XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence)ct.Particle;
879 if (xmlSchemaSequence.Items.Count < 1 && !bCreatingNewType)
880 {
881 lastUsedSeqItem = 0;
882 XmlSchemaElement xmlSchemaElement = AddElement(xtr.LocalName, xtr.Prefix, xtr.NamespaceURI, parentSchema, xmlSchemaSequence.Items, -1);
883 xmlSchemaElement.MinOccurs = 0m;
884 return xmlSchemaElement;
885 }
886 if (xmlSchemaSequence.Items[0].GetType() == typeof(XmlSchemaChoice))
887 {
888 XmlSchemaChoice xmlSchemaChoice = (XmlSchemaChoice)xmlSchemaSequence.Items[0];
889 for (int i = 0; i < xmlSchemaChoice.Items.Count; i++)
890 {
891 if (!(xmlSchemaChoice.Items[i] is XmlSchemaElement xmlSchemaElement2))
892 {
894 }
895 if (xmlSchemaElement2.Name == xtr.LocalName && parentSchema.TargetNamespace == text)
896 {
897 InferElement(xmlSchemaElement2, bCreatingNewType: false, parentSchema);
898 SetMinMaxOccurs(xmlSchemaElement2, setMaxoccurs);
899 return xmlSchemaElement2;
900 }
901 if (xmlSchemaElement2.RefName.Name == xtr.LocalName && xmlSchemaElement2.RefName.Namespace == xtr.NamespaceURI)
902 {
903 XmlSchemaElement xmlSchemaElement3 = FindGlobalElement(text, xtr.LocalName, out parentSchema);
904 InferElement(xmlSchemaElement3, bCreatingNewType: false, parentSchema);
905 SetMinMaxOccurs(xmlSchemaElement2, setMaxoccurs);
906 return xmlSchemaElement3;
907 }
908 }
909 return AddElement(xtr.LocalName, xtr.Prefix, xtr.NamespaceURI, parentSchema, xmlSchemaChoice.Items, -1);
910 }
911 int num = 0;
912 if (lastUsedSeqItem >= 0)
913 {
914 num = lastUsedSeqItem;
915 }
916 XmlSchemaParticle xmlSchemaParticle = xmlSchemaSequence.Items[num] as XmlSchemaParticle;
917 if (!(xmlSchemaParticle is XmlSchemaElement xmlSchemaElement4))
918 {
920 }
921 if (xmlSchemaElement4.Name == xtr.LocalName && parentSchema.TargetNamespace == text)
922 {
923 if (!flag)
924 {
925 xmlSchemaElement4.MaxOccurs = decimal.MaxValue;
926 }
927 lastUsedSeqItem = num;
928 InferElement(xmlSchemaElement4, bCreatingNewType: false, parentSchema);
929 SetMinMaxOccurs(xmlSchemaElement4, setMaxOccurs: false);
930 return xmlSchemaElement4;
931 }
932 if (xmlSchemaElement4.RefName.Name == xtr.LocalName && xmlSchemaElement4.RefName.Namespace == xtr.NamespaceURI)
933 {
934 if (!flag)
935 {
936 xmlSchemaElement4.MaxOccurs = decimal.MaxValue;
937 }
938 lastUsedSeqItem = num;
939 XmlSchemaElement xse = FindGlobalElement(text, xtr.LocalName, out parentSchema);
940 InferElement(xse, bCreatingNewType: false, parentSchema);
941 SetMinMaxOccurs(xmlSchemaElement4, setMaxOccurs: false);
942 return xmlSchemaElement4;
943 }
944 if (flag && xmlSchemaElement4.MinOccurs != 0m)
945 {
946 xmlSchemaObjectCollection.Add(xmlSchemaElement4);
947 }
948 for (num++; num < xmlSchemaSequence.Items.Count; num++)
949 {
950 xmlSchemaParticle = xmlSchemaSequence.Items[num] as XmlSchemaParticle;
951 if (!(xmlSchemaParticle is XmlSchemaElement xmlSchemaElement5))
952 {
954 }
955 if (xmlSchemaElement5.Name == xtr.LocalName && parentSchema.TargetNamespace == text)
956 {
957 lastUsedSeqItem = num;
958 for (int j = 0; j < xmlSchemaObjectCollection.Count; j++)
959 {
960 ((XmlSchemaElement)xmlSchemaObjectCollection[j]).MinOccurs = 0m;
961 }
962 InferElement(xmlSchemaElement5, bCreatingNewType: false, parentSchema);
963 SetMinMaxOccurs(xmlSchemaElement5, setMaxoccurs);
964 return xmlSchemaElement5;
965 }
966 if (xmlSchemaElement5.RefName.Name == xtr.LocalName && xmlSchemaElement5.RefName.Namespace == xtr.NamespaceURI)
967 {
968 lastUsedSeqItem = num;
969 for (int k = 0; k < xmlSchemaObjectCollection.Count; k++)
970 {
971 ((XmlSchemaElement)xmlSchemaObjectCollection[k]).MinOccurs = 0m;
972 }
973 XmlSchemaElement xmlSchemaElement6 = FindGlobalElement(text, xtr.LocalName, out parentSchema);
974 InferElement(xmlSchemaElement6, bCreatingNewType: false, parentSchema);
975 SetMinMaxOccurs(xmlSchemaElement5, setMaxoccurs);
976 return xmlSchemaElement6;
977 }
978 xmlSchemaObjectCollection.Add(xmlSchemaElement5);
979 }
980 XmlSchemaElement xmlSchemaElement7 = null;
981 XmlSchemaElement xse2 = null;
982 if (parentSchema.TargetNamespace == text)
983 {
984 xmlSchemaElement7 = FindElement(xmlSchemaSequence.Items, xtr.LocalName);
985 xse2 = xmlSchemaElement7;
986 }
987 else
988 {
989 xmlSchemaElement7 = FindElementRef(xmlSchemaSequence.Items, xtr.LocalName, xtr.NamespaceURI);
990 if (xmlSchemaElement7 != null)
991 {
992 xse2 = FindGlobalElement(text, xtr.LocalName, out parentSchema);
993 }
994 }
995 if (xmlSchemaElement7 != null)
996 {
997 XmlSchemaChoice xmlSchemaChoice2 = new XmlSchemaChoice();
998 xmlSchemaChoice2.MaxOccurs = decimal.MaxValue;
999 SetMinMaxOccurs(xmlSchemaElement7, setMaxoccurs);
1000 InferElement(xse2, bCreatingNewType: false, parentSchema);
1001 for (int l = 0; l < xmlSchemaSequence.Items.Count; l++)
1002 {
1003 xmlSchemaChoice2.Items.Add(CreateNewElementforChoice((XmlSchemaElement)xmlSchemaSequence.Items[l]));
1004 }
1005 xmlSchemaSequence.Items.Clear();
1006 xmlSchemaSequence.Items.Add(xmlSchemaChoice2);
1007 return xmlSchemaElement7;
1008 }
1009 xmlSchemaElement7 = AddElement(xtr.LocalName, xtr.Prefix, xtr.NamespaceURI, parentSchema, xmlSchemaSequence.Items, ++lastUsedSeqItem);
1010 if (!bCreatingNewType)
1011 {
1012 xmlSchemaElement7.MinOccurs = 0m;
1013 }
1014 return xmlSchemaElement7;
1015 }
1017 }
1018
1019 internal void ProcessAttributes(ref XmlSchemaElement xse, XmlSchemaType effectiveSchemaType, bool bCreatingNewType, XmlSchema parentSchema)
1020 {
1021 XmlSchemaObjectCollection xmlSchemaObjectCollection = new XmlSchemaObjectCollection();
1022 XmlSchemaComplexType xmlSchemaComplexType = effectiveSchemaType as XmlSchemaComplexType;
1023 do
1024 {
1025 if (_xtr.NamespaceURI == "http://www.w3.org/2001/XMLSchema")
1026 {
1028 }
1029 if (_xtr.NamespaceURI == "http://www.w3.org/2000/xmlns/")
1030 {
1031 if (_xtr.Prefix == "xmlns")
1032 {
1033 _namespaceManager.AddNamespace(_xtr.LocalName, _xtr.Value);
1034 }
1035 continue;
1036 }
1037 if (_xtr.NamespaceURI == "http://www.w3.org/2001/XMLSchema-instance")
1038 {
1039 string localName = _xtr.LocalName;
1040 if (localName == "nil")
1041 {
1042 xse.IsNillable = true;
1043 }
1044 else if (localName != "type" && localName != "schemaLocation" && localName != "noNamespaceSchemaLocation")
1045 {
1047 }
1048 continue;
1049 }
1050 if (xmlSchemaComplexType == null || xmlSchemaComplexType == XmlSchemaComplexType.AnyType)
1051 {
1052 xmlSchemaComplexType = new XmlSchemaComplexType();
1053 xse.SchemaType = xmlSchemaComplexType;
1054 }
1055 XmlSchemaAttribute xmlSchemaAttribute = null;
1056 if (effectiveSchemaType != null && effectiveSchemaType.Datatype != null && !xse.SchemaTypeName.IsEmpty)
1057 {
1058 XmlSchemaSimpleContent xmlSchemaSimpleContent = (XmlSchemaSimpleContent)(xmlSchemaComplexType.ContentModel = new XmlSchemaSimpleContent());
1059 XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension = (XmlSchemaSimpleContentExtension)(xmlSchemaSimpleContent.Content = new XmlSchemaSimpleContentExtension());
1060 xmlSchemaSimpleContentExtension.BaseTypeName = xse.SchemaTypeName;
1061 xmlSchemaSimpleContentExtension.LineNumber = xse.LineNumber;
1062 xse.LineNumber = 0;
1063 xse.SchemaTypeName = XmlQualifiedName.Empty;
1064 }
1065 if (xmlSchemaComplexType.ContentModel != null)
1066 {
1067 XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension2 = CheckSimpleContentExtension(xmlSchemaComplexType);
1068 xmlSchemaAttribute = AddAttribute(_xtr.LocalName, _xtr.Prefix, _xtr.NamespaceURI, _xtr.Value, bCreatingNewType, parentSchema, xmlSchemaSimpleContentExtension2.Attributes, xmlSchemaComplexType.AttributeUses);
1069 }
1070 else
1071 {
1072 xmlSchemaAttribute = AddAttribute(_xtr.LocalName, _xtr.Prefix, _xtr.NamespaceURI, _xtr.Value, bCreatingNewType, parentSchema, xmlSchemaComplexType.Attributes, xmlSchemaComplexType.AttributeUses);
1073 }
1074 if (xmlSchemaAttribute != null)
1075 {
1076 xmlSchemaObjectCollection.Add(xmlSchemaAttribute);
1077 }
1078 }
1079 while (_xtr.MoveToNextAttribute());
1080 if (!bCreatingNewType && xmlSchemaComplexType != null)
1081 {
1082 MakeExistingAttributesOptional(xmlSchemaComplexType, xmlSchemaObjectCollection);
1083 }
1084 }
1085
1087 {
1088 for (int i = 0; i < scExtension.Attributes.Count; i++)
1089 {
1090 ct.Attributes.Add(scExtension.Attributes[i]);
1091 }
1092 }
1093
1094 private void MoveAttributes(XmlSchemaComplexType ct, XmlSchemaSimpleContentExtension simpleContentExtension, bool bCreatingNewType)
1095 {
1096 ICollection collection = ((bCreatingNewType || ct.AttributeUses.Count <= 0) ? ct.Attributes : ct.AttributeUses.Values);
1098 {
1099 simpleContentExtension.Attributes.Add(item);
1100 }
1101 ct.Attributes.Clear();
1102 }
1103
1104 internal XmlSchemaAttribute FindAttribute(ICollection attributes, string attrName)
1105 {
1106 foreach (XmlSchemaObject attribute in attributes)
1107 {
1108 if (attribute is XmlSchemaAttribute xmlSchemaAttribute && xmlSchemaAttribute.Name == attrName)
1109 {
1110 return xmlSchemaAttribute;
1111 }
1112 }
1113 return null;
1114 }
1115
1116 internal XmlSchemaElement FindGlobalElement(string namespaceURI, string localName, out XmlSchema parentSchema)
1117 {
1118 ICollection collection = _schemaSet.Schemas(namespaceURI);
1119 XmlSchemaElement xmlSchemaElement = null;
1120 parentSchema = null;
1121 foreach (XmlSchema item in collection)
1122 {
1123 xmlSchemaElement = FindElement(item.Items, localName);
1124 if (xmlSchemaElement != null)
1125 {
1126 parentSchema = item;
1127 return xmlSchemaElement;
1128 }
1129 }
1130 return null;
1131 }
1132
1133 internal XmlSchemaElement FindElement(XmlSchemaObjectCollection elements, string elementName)
1134 {
1135 for (int i = 0; i < elements.Count; i++)
1136 {
1137 if (elements[i] is XmlSchemaElement xmlSchemaElement && xmlSchemaElement.RefName != null && xmlSchemaElement.Name == elementName)
1138 {
1139 return xmlSchemaElement;
1140 }
1141 }
1142 return null;
1143 }
1144
1145 internal XmlSchemaAttribute FindAttributeRef(ICollection attributes, string attributeName, string nsURI)
1146 {
1147 foreach (XmlSchemaObject attribute in attributes)
1148 {
1149 if (attribute is XmlSchemaAttribute xmlSchemaAttribute && xmlSchemaAttribute.RefName.Name == attributeName && xmlSchemaAttribute.RefName.Namespace == nsURI)
1150 {
1151 return xmlSchemaAttribute;
1152 }
1153 }
1154 return null;
1155 }
1156
1157 internal XmlSchemaElement FindElementRef(XmlSchemaObjectCollection elements, string elementName, string nsURI)
1158 {
1159 for (int i = 0; i < elements.Count; i++)
1160 {
1161 if (elements[i] is XmlSchemaElement xmlSchemaElement && xmlSchemaElement.RefName != null && xmlSchemaElement.RefName.Name == elementName && xmlSchemaElement.RefName.Namespace == nsURI)
1162 {
1163 return xmlSchemaElement;
1164 }
1165 }
1166 return null;
1167 }
1168
1170 {
1171 if (ct == null)
1172 {
1174 }
1175 if (ct.ContentModel != null)
1176 {
1177 XmlSchemaSimpleContentExtension xmlSchemaSimpleContentExtension = CheckSimpleContentExtension(ct);
1178 SwitchUseToOptional(xmlSchemaSimpleContentExtension.Attributes, attributesInInstance);
1179 }
1180 else
1181 {
1182 SwitchUseToOptional(ct.Attributes, attributesInInstance);
1183 }
1184 }
1185
1186 private void SwitchUseToOptional(XmlSchemaObjectCollection attributes, XmlSchemaObjectCollection attributesInInstance)
1187 {
1188 for (int i = 0; i < attributes.Count; i++)
1189 {
1190 if (!(attributes[i] is XmlSchemaAttribute xmlSchemaAttribute))
1191 {
1192 continue;
1193 }
1194 if (attributesInInstance != null)
1195 {
1196 if (xmlSchemaAttribute.RefName.Name.Length == 0)
1197 {
1198 if (FindAttribute(attributesInInstance, xmlSchemaAttribute.Name) == null)
1199 {
1200 xmlSchemaAttribute.Use = XmlSchemaUse.Optional;
1201 }
1202 }
1203 else if (FindAttributeRef(attributesInInstance, xmlSchemaAttribute.RefName.Name, xmlSchemaAttribute.RefName.Namespace) == null)
1204 {
1205 xmlSchemaAttribute.Use = XmlSchemaUse.Optional;
1206 }
1207 }
1208 else
1209 {
1210 xmlSchemaAttribute.Use = XmlSchemaUse.Optional;
1211 }
1212 }
1213 }
1214
1215 internal XmlQualifiedName RefineSimpleType(string s, ref int iTypeFlags)
1216 {
1217 bool bNeedsRangeCheck = false;
1218 s = s.Trim();
1219 if (iTypeFlags == 262144 || _typeInference == InferenceOption.Relaxed)
1220 {
1221 return ST_string;
1222 }
1223 iTypeFlags &= InferSimpleType(s, ref bNeedsRangeCheck);
1224 if (iTypeFlags == 262144)
1225 {
1226 return ST_string;
1227 }
1228 if (bNeedsRangeCheck)
1229 {
1230 if (((uint)iTypeFlags & 2u) != 0)
1231 {
1232 try
1233 {
1235 if (((uint)iTypeFlags & 4u) != 0)
1236 {
1237 return ST_unsignedByte;
1238 }
1239 return ST_byte;
1240 }
1241 catch (FormatException)
1242 {
1243 }
1244 catch (OverflowException)
1245 {
1246 }
1247 iTypeFlags &= -3;
1248 }
1249 if (((uint)iTypeFlags & 4u) != 0)
1250 {
1251 try
1252 {
1254 return ST_unsignedByte;
1255 }
1256 catch (FormatException)
1257 {
1258 }
1259 catch (OverflowException)
1260 {
1261 }
1262 iTypeFlags &= -5;
1263 }
1264 if (((uint)iTypeFlags & 8u) != 0)
1265 {
1266 try
1267 {
1269 if (((uint)iTypeFlags & 0x10u) != 0)
1270 {
1271 return ST_unsignedShort;
1272 }
1273 return ST_short;
1274 }
1275 catch (FormatException)
1276 {
1277 }
1278 catch (OverflowException)
1279 {
1280 }
1281 iTypeFlags &= -9;
1282 }
1283 if (((uint)iTypeFlags & 0x10u) != 0)
1284 {
1285 try
1286 {
1288 return ST_unsignedShort;
1289 }
1290 catch (FormatException)
1291 {
1292 }
1293 catch (OverflowException)
1294 {
1295 }
1296 iTypeFlags &= -17;
1297 }
1298 if (((uint)iTypeFlags & 0x20u) != 0)
1299 {
1300 try
1301 {
1303 if (((uint)iTypeFlags & 0x40u) != 0)
1304 {
1305 return ST_unsignedInt;
1306 }
1307 return ST_int;
1308 }
1309 catch (FormatException)
1310 {
1311 }
1312 catch (OverflowException)
1313 {
1314 }
1315 iTypeFlags &= -33;
1316 }
1317 if (((uint)iTypeFlags & 0x40u) != 0)
1318 {
1319 try
1320 {
1322 return ST_unsignedInt;
1323 }
1324 catch (FormatException)
1325 {
1326 }
1327 catch (OverflowException)
1328 {
1329 }
1330 iTypeFlags &= -65;
1331 }
1332 if (((uint)iTypeFlags & 0x80u) != 0)
1333 {
1334 try
1335 {
1337 if (((uint)iTypeFlags & 0x100u) != 0)
1338 {
1339 return ST_unsignedLong;
1340 }
1341 return ST_long;
1342 }
1343 catch (FormatException)
1344 {
1345 }
1346 catch (OverflowException)
1347 {
1348 }
1349 iTypeFlags &= -129;
1350 }
1351 if (((uint)iTypeFlags & 0x100u) != 0)
1352 {
1353 try
1354 {
1356 return ST_unsignedLong;
1357 }
1358 catch (FormatException)
1359 {
1360 }
1361 catch (OverflowException)
1362 {
1363 }
1364 iTypeFlags &= -257;
1365 }
1366 if (((uint)iTypeFlags & 0x1000u) != 0)
1367 {
1368 try
1369 {
1370 double num = XmlConvert.ToDouble(s);
1371 if (((uint)iTypeFlags & 0x200u) != 0)
1372 {
1373 return ST_integer;
1374 }
1375 if (((uint)iTypeFlags & 0x400u) != 0)
1376 {
1377 return ST_decimal;
1378 }
1379 if (((uint)iTypeFlags & 0x800u) != 0)
1380 {
1381 try
1382 {
1383 float num2 = XmlConvert.ToSingle(s);
1384 if (string.Equals(XmlConvert.ToString(num2), XmlConvert.ToString(num), StringComparison.OrdinalIgnoreCase))
1385 {
1386 return ST_float;
1387 }
1388 }
1389 catch (FormatException)
1390 {
1391 }
1392 catch (OverflowException)
1393 {
1394 }
1395 }
1396 iTypeFlags &= -2049;
1397 return ST_double;
1398 }
1399 catch (FormatException)
1400 {
1401 }
1402 catch (OverflowException)
1403 {
1404 }
1405 iTypeFlags &= -4097;
1406 }
1407 if (((uint)iTypeFlags & 0x800u) != 0)
1408 {
1409 try
1410 {
1412 if (((uint)iTypeFlags & 0x200u) != 0)
1413 {
1414 return ST_integer;
1415 }
1416 if (((uint)iTypeFlags & 0x400u) != 0)
1417 {
1418 return ST_decimal;
1419 }
1420 return ST_float;
1421 }
1422 catch (FormatException)
1423 {
1424 }
1425 catch (OverflowException)
1426 {
1427 }
1428 iTypeFlags &= -2049;
1429 }
1430 if (((uint)iTypeFlags & 0x200u) != 0)
1431 {
1432 return ST_integer;
1433 }
1434 if (((uint)iTypeFlags & 0x400u) != 0)
1435 {
1436 return ST_decimal;
1437 }
1438 if (iTypeFlags == 393216)
1439 {
1440 try
1441 {
1443 return ST_gYearMonth;
1444 }
1445 catch (FormatException)
1446 {
1447 }
1448 catch (OverflowException)
1449 {
1450 }
1451 iTypeFlags = 262144;
1452 return ST_string;
1453 }
1454 if (iTypeFlags == 270336)
1455 {
1456 try
1457 {
1459 return ST_duration;
1460 }
1461 catch (FormatException)
1462 {
1463 }
1464 catch (OverflowException)
1465 {
1466 }
1467 iTypeFlags = 262144;
1468 return ST_string;
1469 }
1470 if (iTypeFlags == 262145)
1471 {
1472 return ST_boolean;
1473 }
1474 }
1475 return iTypeFlags switch
1476 {
1477 262144 => ST_string,
1478 1 => ST_boolean,
1479 2 => ST_byte,
1480 4 => ST_unsignedByte,
1481 8 => ST_short,
1482 16 => ST_unsignedShort,
1483 32 => ST_int,
1484 64 => ST_unsignedInt,
1485 128 => ST_long,
1486 256 => ST_unsignedLong,
1487 512 => ST_integer,
1488 1024 => ST_decimal,
1489 2048 => ST_float,
1490 4096 => ST_double,
1491 8192 => ST_duration,
1492 16384 => ST_dateTime,
1493 32768 => ST_time,
1494 65536 => ST_date,
1495 131072 => ST_gYearMonth,
1496 262145 => ST_boolean,
1497 278528 => ST_dateTime,
1498 327680 => ST_date,
1499 294912 => ST_time,
1500 268288 => ST_float,
1501 266240 => ST_double,
1502 _ => ST_string,
1503 };
1504 }
1505
1506 internal static int InferSimpleType(string s, ref bool bNeedsRangeCheck)
1507 {
1508 bool flag = false;
1509 bool flag2 = false;
1510 bool bDate = false;
1511 bool bTime = false;
1512 bool flag3 = false;
1513 if (s.Length == 0)
1514 {
1515 return 262144;
1516 }
1517 int num = 0;
1518 char c8;
1519 switch (s[num])
1520 {
1521 case 'f':
1522 case 't':
1523 if (s == "true")
1524 {
1525 return 262145;
1526 }
1527 if (s == "false")
1528 {
1529 return 262145;
1530 }
1531 return 262144;
1532 case 'N':
1533 if (s == "NaN")
1534 {
1535 return 268288;
1536 }
1537 return 262144;
1538 case 'I':
1539 if (s.AsSpan(num).SequenceEqual("INF"))
1540 {
1541 return 268288;
1542 }
1543 return 262144;
1544 case '.':
1545 {
1546 bNeedsRangeCheck = true;
1547 num++;
1548 if (num == s.Length)
1549 {
1550 if (num == 1 || (num == 2 && (flag2 || flag)))
1551 {
1552 return 262144;
1553 }
1554 return 269312;
1555 }
1556 char c21 = s[num];
1557 if (c21 != 'E' && c21 != 'e')
1558 {
1559 if (s[num] < '0' || s[num] > '9')
1560 {
1561 return 262144;
1562 }
1563 while (true)
1564 {
1565 num++;
1566 if (num == s.Length)
1567 {
1568 return 269312;
1569 }
1570 char c22 = s[num];
1571 if (c22 == 'E' || c22 == 'e')
1572 {
1573 break;
1574 }
1575 if (s[num] < '0' || s[num] > '9')
1576 {
1577 return 262144;
1578 }
1579 }
1580 }
1581 num++;
1582 if (num == s.Length)
1583 {
1584 return 262144;
1585 }
1586 char c23 = s[num];
1587 if (c23 != '+' && c23 != '-')
1588 {
1589 if (s[num] < '0' || s[num] > '9')
1590 {
1591 return 262144;
1592 }
1593 }
1594 else
1595 {
1596 num++;
1597 if (num == s.Length)
1598 {
1599 return 262144;
1600 }
1601 if (s[num] < '0' || s[num] > '9')
1602 {
1603 return 262144;
1604 }
1605 }
1606 do
1607 {
1608 num++;
1609 if (num == s.Length)
1610 {
1611 return 268288;
1612 }
1613 }
1614 while (s[num] >= '0' && s[num] <= '9');
1615 return 262144;
1616 }
1617 case '-':
1618 {
1619 flag = true;
1620 num++;
1621 if (num == s.Length)
1622 {
1623 return 262144;
1624 }
1625 char c7 = s[num];
1626 if (c7 == '.')
1627 {
1628 goto case '.';
1629 }
1630 if (c7 == 'I')
1631 {
1632 goto case 'I';
1633 }
1634 if (c7 == 'P')
1635 {
1636 goto case 'P';
1637 }
1638 if (s[num] < '0' || s[num] > '9')
1639 {
1640 return 262144;
1641 }
1642 goto case '0';
1643 }
1644 case '+':
1645 {
1646 flag2 = true;
1647 num++;
1648 if (num == s.Length)
1649 {
1650 return 262144;
1651 }
1652 char c = s[num];
1653 if (c == '.')
1654 {
1655 goto case '.';
1656 }
1657 if (c == 'P')
1658 {
1659 goto case 'P';
1660 }
1661 if (s[num] < '0' || s[num] > '9')
1662 {
1663 return 262144;
1664 }
1665 goto case '0';
1666 }
1667 case 'P':
1668 {
1669 num++;
1670 if (num == s.Length)
1671 {
1672 return 262144;
1673 }
1674 char c10 = s[num];
1675 if (c10 != 'T')
1676 {
1677 if (s[num] < '0' || s[num] > '9')
1678 {
1679 return 262144;
1680 }
1681 while (true)
1682 {
1683 num++;
1684 if (num == s.Length)
1685 {
1686 return 262144;
1687 }
1688 char c11 = s[num];
1689 if (c11 != 'D')
1690 {
1691 if (c11 == 'M')
1692 {
1693 goto IL_0444;
1694 }
1695 if (c11 != 'Y')
1696 {
1697 if (s[num] < '0' || s[num] > '9')
1698 {
1699 return 262144;
1700 }
1701 continue;
1702 }
1703 num++;
1704 if (num == s.Length)
1705 {
1706 bNeedsRangeCheck = true;
1707 return 270336;
1708 }
1709 char c12 = s[num];
1710 if (c12 == 'T')
1711 {
1712 break;
1713 }
1714 if (s[num] < '0' || s[num] > '9')
1715 {
1716 return 262144;
1717 }
1718 while (true)
1719 {
1720 num++;
1721 if (num == s.Length)
1722 {
1723 return 262144;
1724 }
1725 char c13 = s[num];
1726 if (c13 == 'D')
1727 {
1728 break;
1729 }
1730 if (c13 != 'M')
1731 {
1732 if (s[num] < '0' || s[num] > '9')
1733 {
1734 return 262144;
1735 }
1736 continue;
1737 }
1738 goto IL_0444;
1739 }
1740 }
1741 goto IL_04d2;
1742 IL_04d2:
1743 num++;
1744 if (num == s.Length)
1745 {
1746 bNeedsRangeCheck = true;
1747 return 270336;
1748 }
1749 char c14 = s[num];
1750 if (c14 == 'T')
1751 {
1752 break;
1753 }
1754 return 262144;
1755 IL_0444:
1756 num++;
1757 if (num == s.Length)
1758 {
1759 bNeedsRangeCheck = true;
1760 return 270336;
1761 }
1762 char c15 = s[num];
1763 if (c15 == 'T')
1764 {
1765 break;
1766 }
1767 if (s[num] < '0' || s[num] > '9')
1768 {
1769 return 262144;
1770 }
1771 while (true)
1772 {
1773 num++;
1774 if (num == s.Length)
1775 {
1776 return 262144;
1777 }
1778 char c16 = s[num];
1779 if (c16 == 'D')
1780 {
1781 break;
1782 }
1783 if (s[num] < '0' || s[num] > '9')
1784 {
1785 return 262144;
1786 }
1787 }
1788 goto IL_04d2;
1789 }
1790 }
1791 num++;
1792 if (num == s.Length)
1793 {
1794 return 262144;
1795 }
1796 if (s[num] < '0' || s[num] > '9')
1797 {
1798 return 262144;
1799 }
1800 while (true)
1801 {
1802 num++;
1803 if (num == s.Length)
1804 {
1805 return 262144;
1806 }
1807 char c17 = s[num];
1808 if ((uint)c17 <= 72u)
1809 {
1810 if (c17 != '.')
1811 {
1812 if (c17 != 'H')
1813 {
1814 goto IL_057e;
1815 }
1816 num++;
1817 if (num == s.Length)
1818 {
1819 bNeedsRangeCheck = true;
1820 return 270336;
1821 }
1822 if (s[num] < '0' || s[num] > '9')
1823 {
1824 return 262144;
1825 }
1826 while (true)
1827 {
1828 num++;
1829 if (num == s.Length)
1830 {
1831 return 262144;
1832 }
1833 char c18 = s[num];
1834 if (c18 == '.')
1835 {
1836 break;
1837 }
1838 if (c18 != 'M')
1839 {
1840 if (c18 == 'S')
1841 {
1842 goto end_IL_0535;
1843 }
1844 if (s[num] < '0' || s[num] > '9')
1845 {
1846 return 262144;
1847 }
1848 continue;
1849 }
1850 goto IL_0629;
1851 }
1852 }
1853 goto IL_06ad;
1854 }
1855 if (c17 != 'M')
1856 {
1857 if (c17 == 'S')
1858 {
1859 break;
1860 }
1861 goto IL_057e;
1862 }
1863 goto IL_0629;
1864 IL_057e:
1865 if (s[num] < '0' || s[num] > '9')
1866 {
1867 return 262144;
1868 }
1869 continue;
1870 IL_06ad:
1871 num++;
1872 if (num == s.Length)
1873 {
1874 bNeedsRangeCheck = true;
1875 return 270336;
1876 }
1877 if (s[num] < '0' || s[num] > '9')
1878 {
1879 return 262144;
1880 }
1881 while (true)
1882 {
1883 num++;
1884 if (num == s.Length)
1885 {
1886 return 262144;
1887 }
1888 char c19 = s[num];
1889 if (c19 == 'S')
1890 {
1891 break;
1892 }
1893 if (s[num] < '0' || s[num] > '9')
1894 {
1895 return 262144;
1896 }
1897 }
1898 break;
1899 IL_0629:
1900 num++;
1901 if (num == s.Length)
1902 {
1903 bNeedsRangeCheck = true;
1904 return 270336;
1905 }
1906 if (s[num] < '0' || s[num] > '9')
1907 {
1908 return 262144;
1909 }
1910 while (true)
1911 {
1912 num++;
1913 if (num == s.Length)
1914 {
1915 return 262144;
1916 }
1917 char c20 = s[num];
1918 if (c20 == '.')
1919 {
1920 break;
1921 }
1922 if (c20 == 'S')
1923 {
1924 goto end_IL_0535;
1925 }
1926 if (s[num] < '0' || s[num] > '9')
1927 {
1928 return 262144;
1929 }
1930 }
1931 goto IL_06ad;
1932 continue;
1933 end_IL_0535:
1934 break;
1935 }
1936 num++;
1937 if (num == s.Length)
1938 {
1939 bNeedsRangeCheck = true;
1940 return 270336;
1941 }
1942 return 262144;
1943 }
1944 case '0':
1945 case '1':
1946 case '2':
1947 case '3':
1948 case '4':
1949 case '5':
1950 case '6':
1951 case '7':
1952 case '8':
1953 case '9':
1954 {
1955 num++;
1956 if (num == s.Length)
1957 {
1958 bNeedsRangeCheck = true;
1959 if (flag || flag2)
1960 {
1961 return 269994;
1962 }
1963 if (s == "0" || s == "1")
1964 {
1965 return 270335;
1966 }
1967 return 270334;
1968 }
1969 char c2 = s[num];
1970 if (c2 != '.')
1971 {
1972 if (c2 == 'E' || c2 == 'e')
1973 {
1974 bNeedsRangeCheck = true;
1975 return 268288;
1976 }
1977 if (s[num] < '0' || s[num] > '9')
1978 {
1979 return 262144;
1980 }
1981 num++;
1982 if (num == s.Length)
1983 {
1984 bNeedsRangeCheck = true;
1985 if (flag || flag2)
1986 {
1987 return 269994;
1988 }
1989 return 270334;
1990 }
1991 char c3 = s[num];
1992 if ((uint)c3 <= 58u)
1993 {
1994 if (c3 == '.')
1995 {
1996 goto case '.';
1997 }
1998 if (c3 == ':')
1999 {
2000 bTime = true;
2001 goto IL_0ca9;
2002 }
2003 }
2004 else if (c3 == 'E' || c3 == 'e')
2005 {
2006 bNeedsRangeCheck = true;
2007 return 268288;
2008 }
2009 if (s[num] < '0' || s[num] > '9')
2010 {
2011 return 262144;
2012 }
2013 num++;
2014 if (num == s.Length)
2015 {
2016 bNeedsRangeCheck = true;
2017 if (flag || flag2)
2018 {
2019 return 269994;
2020 }
2021 return 270334;
2022 }
2023 char c4 = s[num];
2024 if (c4 != '.')
2025 {
2026 if (c4 == 'E' || c4 == 'e')
2027 {
2028 bNeedsRangeCheck = true;
2029 return 268288;
2030 }
2031 if (s[num] < '0' || s[num] > '9')
2032 {
2033 return 262144;
2034 }
2035 while (true)
2036 {
2037 num++;
2038 if (num == s.Length)
2039 {
2040 break;
2041 }
2042 char c5 = s[num];
2043 if ((uint)c5 <= 46u)
2044 {
2045 if (c5 == '-')
2046 {
2047 goto IL_090f;
2048 }
2049 if (c5 == '.')
2050 {
2051 goto case '.';
2052 }
2053 }
2054 else if (c5 == 'E' || c5 == 'e')
2055 {
2056 bNeedsRangeCheck = true;
2057 return 268288;
2058 }
2059 if (s[num] < '0' || s[num] > '9')
2060 {
2061 return 262144;
2062 }
2063 }
2064 bNeedsRangeCheck = true;
2065 if (flag || flag2)
2066 {
2067 return 269994;
2068 }
2069 return 270334;
2070 }
2071 }
2072 goto case '.';
2073 }
2074 default:
2075 {
2076 return 262144;
2077 }
2078 IL_0ac9:
2079 num++;
2080 if (num == s.Length)
2081 {
2082 if (flag3)
2083 {
2084 bNeedsRangeCheck = true;
2085 return 393216;
2086 }
2087 return DateTime(s, bDate, bTime);
2088 }
2089 return 262144;
2090 IL_0ca9:
2091 num++;
2092 if (num == s.Length)
2093 {
2094 return 262144;
2095 }
2096 if (s[num] < '0' || s[num] > '9')
2097 {
2098 return 262144;
2099 }
2100 num++;
2101 if (num == s.Length)
2102 {
2103 return 262144;
2104 }
2105 if (s[num] < '0' || s[num] > '9')
2106 {
2107 return 262144;
2108 }
2109 num++;
2110 if (num == s.Length)
2111 {
2112 return 262144;
2113 }
2114 if (s[num] != ':')
2115 {
2116 return 262144;
2117 }
2118 num++;
2119 if (num == s.Length)
2120 {
2121 return 262144;
2122 }
2123 if (s[num] < '0' || s[num] > '9')
2124 {
2125 return 262144;
2126 }
2127 num++;
2128 if (num == s.Length)
2129 {
2130 return 262144;
2131 }
2132 if (s[num] < '0' || s[num] > '9')
2133 {
2134 return 262144;
2135 }
2136 num++;
2137 if (num == s.Length)
2138 {
2139 return DateTime(s, bDate, bTime);
2140 }
2141 switch (s[num])
2142 {
2143 case 'Z':
2144 case 'z':
2145 break;
2146 case '+':
2147 case '-':
2148 goto IL_0af5;
2149 default:
2150 return 262144;
2151 case '.':
2152 goto IL_0df6;
2153 }
2154 goto IL_0ac9;
2155 IL_0df6:
2156 num++;
2157 if (num == s.Length)
2158 {
2159 return 262144;
2160 }
2161 if (s[num] < '0' || s[num] > '9')
2162 {
2163 return 262144;
2164 }
2165 while (true)
2166 {
2167 num++;
2168 if (num == s.Length)
2169 {
2170 return DateTime(s, bDate, bTime);
2171 }
2172 char c6 = s[num];
2173 if ((uint)c6 <= 45u)
2174 {
2175 if (c6 == '+' || c6 == '-')
2176 {
2177 break;
2178 }
2179 }
2180 else if (c6 == 'Z' || c6 == 'z')
2181 {
2182 goto IL_0ac9;
2183 }
2184 if (s[num] < '0' || s[num] > '9')
2185 {
2186 return 262144;
2187 }
2188 }
2189 goto IL_0af5;
2190 IL_0af5:
2191 num++;
2192 if (num == s.Length)
2193 {
2194 return 262144;
2195 }
2196 if (s[num] < '0' || s[num] > '9')
2197 {
2198 return 262144;
2199 }
2200 num++;
2201 if (num == s.Length)
2202 {
2203 return 262144;
2204 }
2205 if (s[num] < '0' || s[num] > '9')
2206 {
2207 return 262144;
2208 }
2209 num++;
2210 if (num == s.Length)
2211 {
2212 return 262144;
2213 }
2214 if (s[num] != ':')
2215 {
2216 return 262144;
2217 }
2218 goto IL_0b85;
2219 IL_090f:
2220 bDate = true;
2221 num++;
2222 if (num == s.Length)
2223 {
2224 return 262144;
2225 }
2226 if (s[num] < '0' || s[num] > '9')
2227 {
2228 return 262144;
2229 }
2230 num++;
2231 if (num == s.Length)
2232 {
2233 return 262144;
2234 }
2235 if (s[num] < '0' || s[num] > '9')
2236 {
2237 return 262144;
2238 }
2239 num++;
2240 if (num == s.Length)
2241 {
2242 bNeedsRangeCheck = true;
2243 return 393216;
2244 }
2245 c8 = s[num];
2246 if ((uint)c8 <= 45u)
2247 {
2248 if (c8 == '+')
2249 {
2250 flag3 = true;
2251 goto IL_0af5;
2252 }
2253 if (c8 == '-')
2254 {
2255 num++;
2256 if (num == s.Length)
2257 {
2258 return 262144;
2259 }
2260 if (s[num] < '0' || s[num] > '9')
2261 {
2262 return 262144;
2263 }
2264 num++;
2265 if (num == s.Length)
2266 {
2267 return 262144;
2268 }
2269 if (s[num] < '0' || s[num] > '9')
2270 {
2271 return 262144;
2272 }
2273 num++;
2274 if (num == s.Length)
2275 {
2276 return DateTime(s, bDate, bTime);
2277 }
2278 char c9 = s[num];
2279 if ((uint)c9 <= 58u)
2280 {
2281 if (c9 == '+' || c9 == '-')
2282 {
2283 goto IL_0af5;
2284 }
2285 if (c9 == ':')
2286 {
2287 flag3 = true;
2288 goto IL_0b85;
2289 }
2290 }
2291 else
2292 {
2293 if (c9 == 'T')
2294 {
2295 bTime = true;
2296 num++;
2297 if (num == s.Length)
2298 {
2299 return 262144;
2300 }
2301 if (s[num] < '0' || s[num] > '9')
2302 {
2303 return 262144;
2304 }
2305 num++;
2306 if (num == s.Length)
2307 {
2308 return 262144;
2309 }
2310 if (s[num] < '0' || s[num] > '9')
2311 {
2312 return 262144;
2313 }
2314 num++;
2315 if (num == s.Length)
2316 {
2317 return 262144;
2318 }
2319 if (s[num] != ':')
2320 {
2321 return 262144;
2322 }
2323 goto IL_0ca9;
2324 }
2325 if (c9 == 'Z' || c9 == 'z')
2326 {
2327 goto IL_0ac9;
2328 }
2329 }
2330 return 262144;
2331 }
2332 }
2333 else if (c8 == 'Z' || c8 == 'z')
2334 {
2335 flag3 = true;
2336 goto IL_0ac9;
2337 }
2338 return 262144;
2339 IL_0b85:
2340 num++;
2341 if (num == s.Length)
2342 {
2343 return 262144;
2344 }
2345 if (s[num] < '0' || s[num] > '9')
2346 {
2347 return 262144;
2348 }
2349 num++;
2350 if (num == s.Length)
2351 {
2352 return 262144;
2353 }
2354 if (s[num] < '0' || s[num] > '9')
2355 {
2356 return 262144;
2357 }
2358 num++;
2359 if (num == s.Length)
2360 {
2361 if (flag3)
2362 {
2363 bNeedsRangeCheck = true;
2364 return 393216;
2365 }
2366 return DateTime(s, bDate, bTime);
2367 }
2368 return 262144;
2369 }
2370 }
2371
2372 internal static int DateTime(string s, bool bDate, bool bTime)
2373 {
2374 try
2375 {
2377 }
2378 catch (FormatException)
2379 {
2380 return 262144;
2381 }
2382 if (bDate && bTime)
2383 {
2384 return 278528;
2385 }
2386 if (bDate)
2387 {
2388 return 327680;
2389 }
2390 if (bTime)
2391 {
2392 return 294912;
2393 }
2394 return 262144;
2395 }
2396
2398 {
2399 XmlSchemaElement xmlSchemaElement = new XmlSchemaElement();
2400 xmlSchemaElement.Annotation = copyElement.Annotation;
2401 xmlSchemaElement.Block = copyElement.Block;
2402 xmlSchemaElement.DefaultValue = copyElement.DefaultValue;
2403 xmlSchemaElement.Final = copyElement.Final;
2404 xmlSchemaElement.FixedValue = copyElement.FixedValue;
2405 xmlSchemaElement.Form = copyElement.Form;
2406 xmlSchemaElement.Id = copyElement.Id;
2407 if (copyElement.IsNillable)
2408 {
2409 xmlSchemaElement.IsNillable = copyElement.IsNillable;
2410 }
2411 xmlSchemaElement.LineNumber = copyElement.LineNumber;
2412 xmlSchemaElement.LinePosition = copyElement.LinePosition;
2413 xmlSchemaElement.Name = copyElement.Name;
2414 xmlSchemaElement.Namespaces = copyElement.Namespaces;
2415 xmlSchemaElement.RefName = copyElement.RefName;
2416 xmlSchemaElement.SchemaType = copyElement.SchemaType;
2417 xmlSchemaElement.SchemaTypeName = copyElement.SchemaTypeName;
2418 xmlSchemaElement.SourceUri = copyElement.SourceUri;
2419 xmlSchemaElement.SubstitutionGroup = copyElement.SubstitutionGroup;
2420 xmlSchemaElement.UnhandledAttributes = copyElement.UnhandledAttributes;
2421 if (copyElement.MinOccurs != 1m && Occurrence == InferenceOption.Relaxed)
2422 {
2423 xmlSchemaElement.MinOccurs = copyElement.MinOccurs;
2424 }
2425 if (copyElement.MaxOccurs != 1m)
2426 {
2427 xmlSchemaElement.MaxOccurs = copyElement.MaxOccurs;
2428 }
2429 return xmlSchemaElement;
2430 }
2431
2432 private static int GetSchemaType(XmlQualifiedName qname)
2433 {
2434 if (qname == SimpleTypes[0])
2435 {
2436 return 262145;
2437 }
2438 if (qname == SimpleTypes[1])
2439 {
2440 return 269994;
2441 }
2442 if (qname == SimpleTypes[2])
2443 {
2444 return 270334;
2445 }
2446 if (qname == SimpleTypes[3])
2447 {
2448 return 269992;
2449 }
2450 if (qname == SimpleTypes[4])
2451 {
2452 return 270328;
2453 }
2454 if (qname == SimpleTypes[5])
2455 {
2456 return 269984;
2457 }
2458 if (qname == SimpleTypes[6])
2459 {
2460 return 270304;
2461 }
2462 if (qname == SimpleTypes[7])
2463 {
2464 return 269952;
2465 }
2466 if (qname == SimpleTypes[8])
2467 {
2468 return 270208;
2469 }
2470 if (qname == SimpleTypes[9])
2471 {
2472 return 269824;
2473 }
2474 if (qname == SimpleTypes[10])
2475 {
2476 return 269312;
2477 }
2478 if (qname == SimpleTypes[11])
2479 {
2480 return 268288;
2481 }
2482 if (qname == SimpleTypes[12])
2483 {
2484 return 266240;
2485 }
2486 if (qname == SimpleTypes[13])
2487 {
2488 return 270336;
2489 }
2490 if (qname == SimpleTypes[14])
2491 {
2492 return 278528;
2493 }
2494 if (qname == SimpleTypes[15])
2495 {
2496 return 294912;
2497 }
2498 if (qname == SimpleTypes[16])
2499 {
2500 return 65536;
2501 }
2502 if (qname == SimpleTypes[17])
2503 {
2504 return 131072;
2505 }
2506 if (qname == SimpleTypes[18])
2507 {
2508 return 262144;
2509 }
2510 if (qname == null || qname.IsEmpty)
2511 {
2512 return -1;
2513 }
2515 }
2516
2517 internal void SetMinMaxOccurs(XmlSchemaElement el, bool setMaxOccurs)
2518 {
2519 if (Occurrence == InferenceOption.Relaxed)
2520 {
2521 if (setMaxOccurs || el.MaxOccurs > 1m)
2522 {
2523 el.MaxOccurs = decimal.MaxValue;
2524 }
2525 el.MinOccurs = 0m;
2526 }
2527 else if (el.MinOccurs > 1m)
2528 {
2529 el.MinOccurs = 1m;
2530 }
2531 }
2532}
virtual bool Contains(object key)
Definition Hashtable.cs:719
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
static string SchInf_simplecontent
Definition SR.cs:1212
static string SchInf_schematype
Definition SR.cs:1228
static string SchInf_seq
Definition SR.cs:1220
static string Sch_NotXsiAttribute
Definition SR.cs:1168
static string SchInf_particle
Definition SR.cs:1216
static string SchInf_entity
Definition SR.cs:1210
static string SchInf_ct
Definition SR.cs:1218
static string SchInf_noct
Definition SR.cs:1224
static string SchInf_noseq
Definition SR.cs:1222
static string SchInf_UnknownParticle
Definition SR.cs:1226
static string SchInf_extension
Definition SR.cs:1214
static string SchInf_NoElement
Definition SR.cs:1230
static string SchInf_schema
Definition SR.cs:1208
Definition SR.cs:7
override? string Get(string value)
Definition NameTable.cs:79
override XmlSchemaObjectCollection Items
XmlSchemaDerivationMethod Final
XmlSchemaDerivationMethod Block
XmlSchemaAttribute FindAttributeRef(ICollection attributes, string attributeName, string nsURI)
static XmlQualifiedName[] SimpleTypes
XmlSchemaAttribute FindAttribute(ICollection attributes, string attrName)
XmlSchema CreateXmlSchema(string targetNS)
XmlSchemaSet InferSchema(XmlReader instanceDocument)
XmlSchemaElement FindMatchingElement(bool bCreatingNewType, XmlReader xtr, XmlSchemaComplexType ct, ref int lastUsedSeqItem, ref bool bParticleChanged, XmlSchema parentSchema, bool setMaxoccurs)
XmlSchemaAttribute AddAttribute(string localName, string prefix, string childURI, string attrValue, bool bCreatingNewType, XmlSchema parentSchema, XmlSchemaObjectCollection addLocation, XmlSchemaObjectTable compiledAttributes)
void ProcessAttributes(ref XmlSchemaElement xse, XmlSchemaType effectiveSchemaType, bool bCreatingNewType, XmlSchema parentSchema)
XmlQualifiedName RefineSimpleType(string s, ref int iTypeFlags)
XmlSchemaElement FindElement(XmlSchemaObjectCollection elements, string elementName)
XmlSchemaElement FindGlobalElement(string namespaceURI, string localName, out XmlSchema parentSchema)
XmlSchemaSet InferSchema(XmlReader instanceDocument, XmlSchemaSet schemas)
void SetMinMaxOccurs(XmlSchemaElement el, bool setMaxOccurs)
XmlSchemaElement FindElementRef(XmlSchemaObjectCollection elements, string elementName, string nsURI)
static int DateTime(string s, bool bDate, bool bTime)
XmlSchemaElement CreateNewElementforChoice(XmlSchemaElement copyElement)
XmlSchemaType GetEffectiveSchemaType(XmlSchemaElement elem, bool bCreatingNewType)
XmlSchemaSet InferSchema1(XmlReader instanceDocument, XmlSchemaSet schemas)
void MakeExistingAttributesOptional(XmlSchemaComplexType ct, XmlSchemaObjectCollection attributesInInstance)
void InferElement(XmlSchemaElement xse, bool bCreatingNewType, XmlSchema parentSchema)
XmlSchemaElement AddElement(string localName, string prefix, string childURI, XmlSchema parentSchema, XmlSchemaObjectCollection addLocation, int positionWithinCollection)
void SwitchUseToOptional(XmlSchemaObjectCollection attributes, XmlSchemaObjectCollection attributesInInstance)
static int InferSimpleType(string s, ref bool bNeedsRangeCheck)
readonly XmlNamespaceManager _namespaceManager
static int GetSchemaType(XmlQualifiedName qname)
void MoveAttributes(XmlSchemaSimpleContentExtension scExtension, XmlSchemaComplexType ct)
XmlSchemaSimpleContentExtension CheckSimpleContentExtension(XmlSchemaComplexType ct)
void MoveAttributes(XmlSchemaComplexType ct, XmlSchemaSimpleContentExtension simpleContentExtension, bool bCreatingNewType)
void Insert(int index, XmlSchemaObject item)
XmlSerializerNamespaces Namespaces
override XmlSchemaObjectCollection Items
XmlSchema Reprocess(XmlSchema schema)
XmlSchemaObjectTable GlobalElements
bool Contains(string? targetNamespace)
XmlSchema? Add(string? targetNamespace, string schemaUri)
XmlSchemaObjectTable GlobalTypes
static ? XmlSchemaSimpleType GetBuiltInSimpleType(XmlQualifiedName qualifiedName)
static ? XmlSchemaComplexType GetBuiltInComplexType(XmlTypeCode typeCode)
XmlSchemaObjectCollection Includes
Definition XmlSchema.cs:164
XmlSchemaForm ElementFormDefault
Definition XmlSchema.cs:124
XmlSchemaObjectCollection Items
Definition XmlSchema.cs:174
static uint ToUInt32(string s)
static int ToInt32(string s)
static short ToInt16(string s)
static string ToString(bool value)
static float ToSingle(string s)
static TimeSpan ToTimeSpan(string s)
static double ToDouble(string s)
static sbyte ToSByte(string s)
static DateTime ToDateTime(string s)
static ulong ToUInt64(string s)
static ushort ToUInt16(string s)
static byte ToByte(string s)
static long ToInt64(string s)
virtual ? string LookupNamespace(string prefix)
virtual void AddNamespace(string prefix, string uri)
static readonly XmlQualifiedName Empty
XmlNodeType NodeType
Definition XmlReader.cs:62