Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlSchemaImporter.cs
Go to the documentation of this file.
6
8
10{
23
24 internal sealed class ElementComparer : IComparer
25 {
26 public int Compare(object o1, object o2)
27 {
30 return string.Compare(elementAccessor.ToString(string.Empty), elementAccessor2.ToString(string.Empty), StringComparison.Ordinal);
31 }
32 }
33
34 internal bool GenerateOrder => (base.Options & CodeGenerationOptions.GenerateOrder) != 0;
35
36 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
41
42 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
47
48 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
53
55 {
57 primitiveMapping.TypeDesc = base.Scope.GetTypeDesc("string", "http://www.w3.org/2001/XMLSchema", flags);
58 primitiveMapping.TypeName = primitiveMapping.TypeDesc.DataType.Name;
59 primitiveMapping.Namespace = "http://www.w3.org/2001/XMLSchema";
60 return primitiveMapping;
61 }
62
63 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
82
83 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
85 {
86 return ImportSchemaType(typeName, null, baseTypeCanBeIndirect: false);
87 }
88
89 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
94
95 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
126
127 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
129 {
130 return ImportDerivedTypeMapping(name, null);
131 }
132
133 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
138
139 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
140 public XmlMembersMapping? ImportAnyType(XmlQualifiedName typeName, string elementName)
141 {
142 TypeMapping typeMapping = ImportType(typeName, typeof(MembersMapping), null, TypeFlags.CanBeElementValue, addref: true);
144 if (membersMapping == null)
145 {
149 xmlSchemaElement.Name = elementName;
153 }
154 if (membersMapping.Members.Length != 1 || !membersMapping.Members[0].Accessor.Any)
155 {
156 return null;
157 }
158 membersMapping.Members[0].Name = elementName;
160 elementAccessor.Name = elementName;
163 elementAccessor.Any = true;
164 XmlSchemaObject xmlSchemaObject = base.Schemas.SchemaSet.GlobalTypes[typeName];
166 {
167 elementAccessor.Form = ((xmlSchema.ElementFormDefault == XmlSchemaForm.None) ? XmlSchemaForm.Unqualified : xmlSchema.ElementFormDefault);
168 }
170 }
171
172 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
177
178 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
207
208 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
229
230 [RequiresUnreferencedCode("calls ImportElement")]
248
249 [RequiresUnreferencedCode("calls ImportElementType")]
251 {
252 if (!element.RefName.IsEmpty)
253 {
256 {
260 return elementAccessor2;
261 }
262 return elementAccessor;
263 }
264 if (element.Name.Length == 0)
265 {
268 }
269 string identifier2 = Accessor.UnescapeName(element.Name);
274 elementAccessor3.Name = element.Name;
278 if (element.DefaultValue != null)
279 {
281 }
282 else if (element.FixedValue != null)
283 {
286 }
288 {
290 }
292 if (topLevelElement)
293 {
295 }
296 else
297 {
298 elementAccessor3.Form = ElementForm(ns, element);
299 }
300 return elementAccessor3;
301 }
302
303 [RequiresUnreferencedCode("calls ImportMembersType")]
305 {
307 if (!element.SchemaTypeName.IsEmpty)
308 {
309 typeMapping = ImportType(element.SchemaTypeName, desiredMappingType, baseType, TypeFlags.CanBeElementValue, addref: false);
310 if (!typeMapping.ReferencedByElement)
311 {
312 object obj = FindType(element.SchemaTypeName, TypeFlags.CanBeElementValue);
314 while (xmlSchemaObject.Parent != null && obj != xmlSchemaObject)
315 {
317 }
319 }
320 }
321 else if (element.SchemaType == null)
322 {
324 }
325 else
326 {
329 }
330 if (!desiredMappingType.IsAssignableFrom(typeMapping.GetType()))
331 {
333 }
334 if (!typeMapping.TypeDesc.IsMappedType)
335 {
336 RunSchemaExtensions(typeMapping, element.SchemaTypeName, element.SchemaType, element, TypeFlags.CanBeElementValue);
337 }
338 return typeMapping;
339 }
340
344
345 private string GenerateUniqueTypeName(string desiredName, string ns)
346 {
347 int num = 1;
348 string text = desiredName;
349 while (true)
350 {
351 XmlQualifiedName name = new XmlQualifiedName(text, ns);
352 object obj = base.Schemas.Find(name, typeof(XmlSchemaType));
353 if (obj == null)
354 {
355 break;
356 }
358 num++;
359 }
361 return base.TypeIdentifiers.AddUnique(text, text);
362 }
363
364 [RequiresUnreferencedCode("calls ImportType")]
366 {
367 foreach (XmlSchema schema in base.Schemas)
368 {
369 if (base.Schemas.IsReference(schema) || XmlSchemas.IsDataSet(schema))
370 {
371 continue;
372 }
374 foreach (object value in schema.SchemaTypes.Values)
375 {
377 {
379 if (xmlSchemaType.DerivedFrom == baseName && base.TypesInUse[xmlSchemaType.Name, schema.TargetNamespace] == null)
380 {
381 ImportType(xmlSchemaType.QualifiedName, typeof(TypeMapping), null, TypeFlags.CanBeElementValue, addref: false);
382 }
383 }
384 }
385 }
386 }
387
388 [RequiresUnreferencedCode("calls FindType")]
390 {
391 if (name.Name == "anyType" && name.Namespace == "http://www.w3.org/2001/XMLSchema")
392 {
393 return ImportRootMapping();
394 }
395 object obj = FindType(name, flags);
396 TypeMapping typeMapping = (TypeMapping)base.ImportedMappings[obj];
397 if (typeMapping != null && desiredMappingType.IsAssignableFrom(typeMapping.GetType()))
398 {
399 return typeMapping;
400 }
401 if (addref)
402 {
404 }
406 {
407 typeMapping = ImportType((XmlSchemaComplexType)obj, name.Namespace, name.Name, desiredMappingType, baseType, flags);
408 }
409 else
410 {
412 {
414 }
415 typeMapping = ImportDataType((XmlSchemaSimpleType)obj, name.Namespace, name.Name, baseType, flags, isList: false);
416 }
417 if (addref && name.Namespace != "http://www.w3.org/2001/XMLSchema")
418 {
419 RemoveReference(name, base.TypesInUse);
420 }
421 return typeMapping;
422 }
423
424 [RequiresUnreferencedCode("calls ImportMembersType")]
426 {
427 if (type.Redefined != null)
428 {
430 }
432 {
434 if (baseType == null && (typeMapping = ImportArrayMapping(type, identifier, typeNs, repeats: false)) == null)
435 {
437 }
438 if (typeMapping == null)
439 {
441 if (typeMapping != null && type.Name != null && type.Name.Length != 0)
442 {
444 }
445 }
446 return typeMapping;
447 }
449 {
450 return ImportMembersType(type, typeNs, identifier);
451 }
452 throw new ArgumentException(System.SR.XmlInternalError, "desiredMappingType");
453 }
454
455 [RequiresUnreferencedCode("calls GetTypeDesc")]
472
473 [RequiresUnreferencedCode("calls GetTypeDesc")]
475 {
476 TypeDesc typeDesc = null;
478 bool flag = false;
479 if (!type.DerivedFrom.IsEmpty)
480 {
481 typeMapping = ImportType(type.DerivedFrom, typeof(TypeMapping), null, (TypeFlags)48, addref: false);
483 {
484 typeDesc = ((StructMapping)typeMapping).TypeDesc;
485 }
486 else if (typeMapping is ArrayMapping)
487 {
488 typeMapping = ((ArrayMapping)typeMapping).TopLevelMapping;
489 if (typeMapping != null)
490 {
493 typeDesc = typeMapping.TypeDesc;
494 }
495 }
496 else
497 {
498 typeMapping = null;
499 }
500 }
501 if (typeDesc == null && baseType != null)
502 {
503 typeDesc = base.Scope.GetTypeDesc(baseType);
504 }
505 if (typeMapping == null)
506 {
508 flag = true;
509 }
510 Mapping mapping = (Mapping)base.ImportedMappings[type];
511 if (mapping != null)
512 {
514 {
515 return (StructMapping)mapping;
516 }
517 if (!arrayLike || !(mapping is ArrayMapping))
518 {
519 throw new InvalidOperationException(System.SR.Format(System.SR.XmlTypeUsedTwice, type.QualifiedName.Name, type.QualifiedName.Namespace));
520 }
522 if (arrayMapping.TopLevelMapping != null)
523 {
524 return arrayMapping.TopLevelMapping;
525 }
526 }
528 structMapping.IsReference = base.Schemas.IsReference(type);
529 TypeFlags typeFlags = TypeFlags.Reference;
531 {
532 typeFlags |= TypeFlags.Abstract;
533 }
538 structMapping.TypeName = ((type.Name == null || type.Name.Length == 0) ? null : identifier);
540 if (!arrayLike)
541 {
542 base.ImportedMappings.Add(type, structMapping);
543 }
545 CodeIdentifiers codeIdentifiers2 = structMapping.BaseMapping.Scope.Clone();
546 codeIdentifiers.AddReserved(text);
547 codeIdentifiers2.AddReserved(text);
549 if (flag)
550 {
552 }
553 bool needExplicitOrder = false;
555 if (!IsAllGroup(type))
556 {
558 {
559 structMapping.SetSequence();
560 }
561 else if (GenerateOrder)
562 {
564 }
565 }
566 for (int i = 0; i < structMapping.Members.Length; i++)
567 {
570 if (memberMapping != null && memberMapping.TypeDesc != structMapping.Members[i].TypeDesc)
571 {
572 throw new InvalidOperationException(System.SR.Format(System.SR.XmlIllegalOverride, type.Name, memberMapping.Name, memberMapping.TypeDesc.FullName, structMapping.Members[i].TypeDesc.FullName, declaringMapping.TypeDesc.FullName));
573 }
574 }
576 base.Scope.AddTypeMapping(structMapping);
577 return structMapping;
578 }
579
581 {
583 if (typeItems.Particle != null)
584 {
586 }
587 return false;
588 }
589
590 [RequiresUnreferencedCode("calls GetTypeDesc")]
611
612 [RequiresUnreferencedCode("calls FindType")]
614 {
616 bool flag = IsMixed(type);
617 if (flag)
618 {
620 while (!xmlSchemaType.DerivedFrom.IsEmpty)
621 {
622 xmlSchemaType = FindType(xmlSchemaType.DerivedFrom, (TypeFlags)48);
624 {
625 flag = false;
626 break;
627 }
628 }
629 }
630 if (typeItems.Particle != null)
631 {
633 }
634 for (int i = 0; i < typeItems.Attributes.Count; i++)
635 {
636 object obj = typeItems.Attributes[i];
638 {
640 }
642 {
645 }
646 }
647 if (typeItems.AnyAttribute != null)
648 {
650 }
651 if (typeItems.baseSimpleType != null || (typeItems.Particle == null && flag))
652 {
653 ImportTextMember(members, membersScope, flag ? null : typeItems.baseSimpleType);
654 }
656 return (MemberMapping[])members.ToArray(typeof(MemberMapping));
657 }
658
659 internal static bool IsMixed(XmlSchemaType type)
660 {
662 {
663 return false;
664 }
666 bool isMixed = xmlSchemaComplexType.IsMixed;
667 if (!isMixed && xmlSchemaComplexType.ContentModel != null && xmlSchemaComplexType.ContentModel is XmlSchemaComplexContent)
668 {
669 isMixed = ((XmlSchemaComplexContent)xmlSchemaComplexType.ContentModel).IsMixed;
670 }
671 return isMixed;
672 }
673
675 {
678 {
681 if (xmlSchemaComplexType.ContentModel != null)
682 {
683 XmlSchemaContent content = xmlSchemaComplexType.ContentModel.Content;
685 {
690 }
691 else if (content is XmlSchemaSimpleContentExtension)
692 {
697 }
698 }
699 else
700 {
704 }
706 {
709 typeItems.IsUnbounded = xmlSchemaParticle.IsMultipleOccurrence;
710 }
712 {
714 typeItems.IsUnbounded = xmlSchemaParticle.IsMultipleOccurrence;
715 }
716 }
717 return typeItems;
718 }
719
720 [RequiresUnreferencedCode("calls ImportChoiceGroup")]
736
737 [RequiresUnreferencedCode("calls GetTypeDesc")]
739 {
742 {
743 groupRepeats = true;
744 }
747 Array.Sort(memberMapping.Elements, new ElementComparer());
749 bool flag = false;
750 bool flag2 = false;
751 Hashtable hashtable = new Hashtable(memberMapping.Elements.Length);
752 for (int i = 0; i < memberMapping.Elements.Length; i++)
753 {
755 string fullName = elementAccessor.Mapping.TypeDesc.FullName;
756 object obj = hashtable[fullName];
757 if (obj != null)
758 {
759 flag = true;
761 if (!flag2 && elementAccessor2.IsNullable != elementAccessor.IsNullable)
762 {
763 flag2 = true;
764 }
765 }
766 else
767 {
768 hashtable.Add(fullName, elementAccessor);
769 }
771 {
772 elementAccessor.Mapping = arrayMapping.TopLevelMapping;
775 }
776 }
777 if (flag2)
778 {
779 memberMapping.TypeDesc = base.Scope.GetTypeDesc(typeof(object));
780 }
781 else
782 {
783 TypeDesc[] array = new TypeDesc[hashtable.Count];
785 for (int j = 0; j < array.Length; j++)
786 {
787 if (!enumerator.MoveNext())
788 {
789 break;
790 }
791 array[j] = ((ElementAccessor)enumerator.Current).Mapping.TypeDesc;
792 }
794 if (memberMapping.TypeDesc == null)
795 {
796 memberMapping.TypeDesc = base.Scope.GetTypeDesc(typeof(object));
797 }
798 }
799 if (groupRepeats)
800 {
801 memberMapping.TypeDesc = memberMapping.TypeDesc.CreateArrayTypeDesc();
802 }
803 if (membersScope != null)
804 {
805 memberMapping.Name = membersScope.AddUnique(groupRepeats ? "Items" : "Item", memberMapping);
807 }
808 if (flag)
809 {
813 memberMapping.ChoiceIdentifier.MemberIds = new string[memberMapping.Elements.Length];
814 ConstantMapping[] constants = ((EnumMapping)memberMapping.ChoiceIdentifier.Mapping).Constants;
815 for (int k = 0; k < memberMapping.Elements.Length; k++)
816 {
817 memberMapping.ChoiceIdentifier.MemberIds[k] = constants[k].Name;
818 }
821 memberMapping2.Name = memberMapping.ChoiceIdentifier.MemberName;
822 if (groupRepeats)
823 {
824 memberMapping2.TypeDesc = memberMapping.ChoiceIdentifier.Mapping.TypeDesc.CreateArrayTypeDesc();
825 }
826 else
827 {
828 memberMapping2.TypeDesc = memberMapping.ChoiceIdentifier.Mapping.TypeDesc;
829 }
833 elementAccessor3.Mapping = memberMapping.ChoiceIdentifier.Mapping;
835 if (membersScope != null)
836 {
837 string text2 = (memberMapping.ChoiceIdentifier.MemberName = membersScope.AddUnique(memberMapping.ChoiceIdentifier.MemberName, memberMapping2));
838 string name = (memberMapping2.Name = text2);
841 }
842 }
843 return memberMapping;
844 }
845
847 {
848 if (arrayMapping.Elements.Length != 1)
849 {
850 return true;
851 }
854 if (elementAccessor.Name != mapping.DefaultElementName)
855 {
856 return true;
857 }
858 if (elementAccessor.Form != 0 && elementAccessor.Form != XmlSchemaForm.Qualified)
859 {
860 return true;
861 }
862 if (elementAccessor.Mapping.TypeDesc != null)
863 {
864 if (elementAccessor.IsNullable != elementAccessor.Mapping.TypeDesc.IsNullable)
865 {
866 return true;
867 }
868 if (elementAccessor.Mapping.TypeDesc.IsAmbiguousDataType)
869 {
870 return true;
871 }
872 }
873 return false;
874 }
875
876 [RequiresUnreferencedCode("calls GatherGroupChoices")]
881
882 [RequiresUnreferencedCode("Calls ImportAny")]
884 {
885 if (particle is XmlSchemaGroupRef)
886 {
888 if (!xmlSchemaGroupRef.RefName.IsEmpty)
889 {
892 {
893 RemoveReference(xmlSchemaGroupRef.RefName, base.GroupsInUse);
894 return true;
895 }
896 RemoveReference(xmlSchemaGroupRef.RefName, base.GroupsInUse);
897 }
898 }
899 else if (particle is XmlSchemaGroupBase)
900 {
902 bool flag = xmlSchemaGroupBase.IsMultipleOccurrence;
904 bool duplicateElements = false;
905 for (int i = 0; i < xmlSchemaGroupBase.Items.Count; i++)
906 {
907 object obj = xmlSchemaGroupBase.Items[i];
909 {
911 {
912 flag = true;
913 }
914 }
915 else if (obj is XmlSchemaAny)
916 {
917 if (GenerateOrder)
918 {
920 }
921 else
922 {
924 }
925 }
926 else
927 {
928 if (!(obj is XmlSchemaElement))
929 {
930 continue;
931 }
934 if (topLevelElement != null)
935 {
937 for (int j = 0; j < equivalentElements.Length; j++)
938 {
939 if (equivalentElements[j].IsMultipleOccurrence)
940 {
941 flag = true;
942 }
944 }
945 }
946 if (xmlSchemaElement.IsMultipleOccurrence)
947 {
948 flag = true;
949 }
951 }
952 }
953 if (xmlSchemaAny != null)
954 {
956 }
957 if (!flag && !(xmlSchemaGroupBase is XmlSchemaChoice) && xmlSchemaGroupBase.Items.Count > 1)
958 {
959 flag = true;
960 }
961 return flag;
962 }
963 return false;
964 }
965
967 {
968 if (scope == null)
969 {
970 return;
971 }
973 if (elementAccessor != null)
974 {
975 if (!allowDuplicates)
976 {
978 }
979 if (elementAccessor.Mapping.TypeDesc != element.Mapping.TypeDesc)
980 {
982 }
983 duplicateElements = true;
984 }
985 else
986 {
987 scope[element.Name, element.Namespace] = element;
988 }
989 }
990
992 {
993 for (int i = 0; i < elements.Length; i++)
994 {
996 }
997 }
998
999 [RequiresUnreferencedCode("calls ImportChoiceGroup")]
1001 {
1002 if (particle is XmlSchemaGroupRef)
1003 {
1005 if (!xmlSchemaGroupRef.RefName.IsEmpty)
1006 {
1009 RemoveReference(xmlSchemaGroupRef.RefName, base.GroupsInUse);
1010 }
1011 }
1012 else
1013 {
1014 if (!(particle is XmlSchemaGroupBase))
1015 {
1016 return;
1017 }
1019 if (xmlSchemaGroupBase.IsMultipleOccurrence)
1020 {
1021 groupRepeats = true;
1022 }
1024 {
1026 return;
1027 }
1028 for (int i = 0; i < xmlSchemaGroupBase.Items.Count; i++)
1029 {
1030 object obj = xmlSchemaGroupBase.Items[i];
1032 {
1034 }
1035 else if (obj is XmlSchemaElement)
1036 {
1038 }
1039 else if (obj is XmlSchemaAny)
1040 {
1042 }
1043 else if (obj is XmlSchemaParticle)
1044 {
1046 }
1047 }
1048 }
1049 }
1050
1052 {
1053 if (!element.RefName.IsEmpty)
1054 {
1055 return FindElement(element.RefName);
1056 }
1057 return null;
1058 }
1059
1061 {
1063 foreach (XmlSchema item in base.Schemas.SchemaSet.Schemas())
1064 {
1065 for (int i = 0; i < item.Items.Count; i++)
1066 {
1067 object obj = item.Items[i];
1069 {
1071 if (!xmlSchemaElement.IsAbstract && xmlSchemaElement.SubstitutionGroup.Namespace == item.TargetNamespace && xmlSchemaElement.SubstitutionGroup.Name == element.Name)
1072 {
1074 }
1075 }
1076 }
1077 }
1079 }
1080
1081 [RequiresUnreferencedCode("calls ImportChoiceGroup")]
1083 {
1085 if (equivalentElements.Length == 0)
1086 {
1087 return false;
1088 }
1090 for (int i = 0; i < equivalentElements.Length; i++)
1091 {
1093 }
1094 if (!element.IsAbstract)
1095 {
1096 xmlSchemaChoice.Items.Add(element);
1097 }
1100 return true;
1101 }
1102
1103 [RequiresUnreferencedCode("calls ImportType")]
1105 {
1106 bool flag = false;
1108 if (simpleContentType != null)
1109 {
1111 if (!(typeMapping is PrimitiveMapping) && !typeMapping.TypeDesc.CanBeTextValue)
1112 {
1113 return;
1114 }
1115 }
1116 else
1117 {
1118 flag = true;
1120 }
1126 if (flag)
1127 {
1128 memberMapping.TypeDesc = textAccessor.Mapping.TypeDesc.CreateArrayTypeDesc();
1129 memberMapping.Name = members.MakeRightCase("Text");
1130 }
1131 else
1132 {
1134 if (primitiveMapping.IsList)
1135 {
1136 memberMapping.TypeDesc = textAccessor.Mapping.TypeDesc.CreateArrayTypeDesc();
1137 memberMapping.Name = members.MakeRightCase("Text");
1138 }
1139 else
1140 {
1141 memberMapping.TypeDesc = textAccessor.Mapping.TypeDesc;
1142 memberMapping.Name = members.MakeRightCase("Value");
1143 }
1144 }
1147 }
1148
1149 [RequiresUnreferencedCode("calls GetTypeDesc")]
1151 {
1152 ElementAccessor[] array = ImportAny(any, !mixed, ns);
1156 memberMapping.Name = membersScope.MakeRightCase("Any");
1159 memberMapping.TypeDesc = array[0].Mapping.TypeDesc;
1160 bool flag = any.IsMultipleOccurrence;
1161 if (mixed)
1162 {
1164 specialMapping.TypeDesc = base.Scope.GetTypeDesc(typeof(XmlNode));
1170 flag = true;
1171 mixed = false;
1172 }
1173 if (flag)
1174 {
1175 memberMapping.TypeDesc = memberMapping.TypeDesc.CreateArrayTypeDesc();
1176 }
1177 return memberMapping;
1178 }
1179
1180 [RequiresUnreferencedCode("calls GetTypeDesc")]
1182 {
1186 TypeFlags typeFlags = TypeFlags.CanBeElementValue;
1187 if (makeElement)
1188 {
1189 typeFlags |= TypeFlags.CanBeTextValue;
1190 }
1192 if (GenerateOrder && any.Namespace != null)
1193 {
1194 NamespaceList namespaceList = new NamespaceList(any.Namespace, targetNamespace);
1195 if (namespaceList.Type == NamespaceList.ListType.Set)
1196 {
1197 ICollection enumerate = namespaceList.Enumerate;
1199 int num = 0;
1200 foreach (string item in namespaceList.Enumerate)
1201 {
1204 elementAccessor.Any = true;
1206 array[num++] = elementAccessor;
1207 }
1208 if (num > 0)
1209 {
1210 return array;
1211 }
1212 }
1213 }
1216 elementAccessor2.Any = true;
1217 return new ElementAccessor[1] { elementAccessor2 };
1218 }
1219
1220 [RequiresUnreferencedCode("calls ImportArrayMapping")]
1221 private ElementAccessor ImportArray(XmlSchemaElement element, string identifier, string ns, bool repeats)
1222 {
1223 if (repeats)
1224 {
1225 return null;
1226 }
1227 if (element.SchemaType == null)
1228 {
1229 return null;
1230 }
1231 if (element.IsMultipleOccurrence)
1232 {
1233 return null;
1234 }
1235 XmlSchemaType schemaType = element.SchemaType;
1237 if (arrayMapping == null)
1238 {
1239 return null;
1240 }
1242 elementAccessor.Name = element.Name;
1245 if (arrayMapping.TypeDesc.IsNullable)
1246 {
1248 }
1249 elementAccessor.Form = ElementForm(ns, element);
1250 return elementAccessor;
1251 }
1252
1253 [RequiresUnreferencedCode("calls ImportChoiceGroup")]
1255 {
1257 {
1258 return null;
1259 }
1260 if (!type.DerivedFrom.IsEmpty)
1261 {
1262 return null;
1263 }
1264 if (IsMixed(type))
1265 {
1266 return null;
1267 }
1268 Mapping mapping = (Mapping)base.ImportedMappings[type];
1269 if (mapping != null)
1270 {
1272 {
1273 return (ArrayMapping)mapping;
1274 }
1275 return null;
1276 }
1278 if (typeItems.Attributes != null && typeItems.Attributes.Count > 0)
1279 {
1280 return null;
1281 }
1282 if (typeItems.AnyAttribute != null)
1283 {
1284 return null;
1285 }
1286 if (typeItems.Particle == null)
1287 {
1288 return null;
1289 }
1290 XmlSchemaGroupBase particle = typeItems.Particle;
1294 if (particle is XmlSchemaChoice)
1295 {
1297 if (!xmlSchemaChoice.IsMultipleOccurrence)
1298 {
1299 return null;
1300 }
1301 bool needExplicitOrder = false;
1303 if (memberMapping.ChoiceIdentifier != null)
1304 {
1305 return null;
1306 }
1309 arrayMapping.TypeName = ((type.Name == null || type.Name.Length == 0) ? ("ArrayOf" + CodeIdentifier.MakePascal(arrayMapping.TypeDesc.Name)) : type.Name);
1310 }
1311 else
1312 {
1313 if (!(particle is XmlSchemaAll) && !(particle is XmlSchemaSequence))
1314 {
1315 return null;
1316 }
1317 if (particle.Items.Count != 1 || !(particle.Items[0] is XmlSchemaElement))
1318 {
1319 return null;
1320 }
1322 if (!xmlSchemaElement.IsMultipleOccurrence)
1323 {
1324 return null;
1325 }
1327 {
1328 return null;
1329 }
1331 if (elementAccessor.Any)
1332 {
1333 return null;
1334 }
1336 arrayMapping.TypeDesc = elementAccessor.Mapping.TypeDesc.CreateArrayTypeDesc();
1337 arrayMapping.TypeName = ((type.Name == null || type.Name.Length == 0) ? ("ArrayOf" + CodeIdentifier.MakePascal(elementAccessor.Mapping.TypeDesc.Name)) : type.Name);
1338 }
1339 base.ImportedMappings[type] = arrayMapping;
1340 base.Scope.AddTypeMapping(arrayMapping);
1343 if (type.Name != null && type.Name.Length != 0)
1344 {
1346 }
1347 return arrayMapping;
1348 }
1349
1351 {
1352 if (!element.RefName.IsEmpty)
1353 {
1356 foreach (string identifier in identifiers)
1357 {
1358 if (text == identifier)
1359 {
1360 return true;
1361 }
1362 }
1364 XmlSchemaType schemaType = xmlSchemaElement.SchemaType;
1365 if (schemaType is XmlSchemaComplexType)
1366 {
1367 TypeItems typeItems = GetTypeItems(schemaType);
1368 if ((typeItems.Particle is XmlSchemaSequence || typeItems.Particle is XmlSchemaAll) && typeItems.Particle.Items.Count == 1 && typeItems.Particle.Items[0] is XmlSchemaElement)
1369 {
1371 if (xmlSchemaElement2.IsMultipleOccurrence)
1372 {
1374 }
1375 }
1376 }
1377 }
1378 return false;
1379 }
1380
1381 [RequiresUnreferencedCode("calls GetTypeDesc")]
1383 {
1384 if (type == null)
1385 {
1386 return null;
1387 }
1388 if (!type.DerivedFrom.IsEmpty)
1389 {
1390 return null;
1391 }
1392 bool flag = IsMixed(type);
1394 if (typeItems.Particle == null)
1395 {
1396 return null;
1397 }
1398 if (!(typeItems.Particle is XmlSchemaAll) && !(typeItems.Particle is XmlSchemaSequence))
1399 {
1400 return null;
1401 }
1402 if (typeItems.Attributes != null && typeItems.Attributes.Count > 0)
1403 {
1404 return null;
1405 }
1406 XmlSchemaGroupBase particle = typeItems.Particle;
1407 if (particle.Items.Count != 1 || !(particle.Items[0] is XmlSchemaAny))
1408 {
1409 return null;
1410 }
1413 if (typeItems.AnyAttribute != null && xmlSchemaAny.IsMultipleOccurrence && flag)
1414 {
1416 specialMapping.TypeDesc = base.Scope.GetTypeDesc(typeof(XmlElement));
1417 }
1418 else
1419 {
1420 if (typeItems.AnyAttribute != null || xmlSchemaAny.IsMultipleOccurrence)
1421 {
1422 return null;
1423 }
1424 specialMapping.TypeDesc = base.Scope.GetTypeDesc(flag ? typeof(XmlNode) : typeof(XmlElement));
1425 }
1426 TypeFlags typeFlags = TypeFlags.CanBeElementValue;
1427 if (typeItems.AnyAttribute != null || flag)
1428 {
1429 typeFlags |= TypeFlags.CanBeTextValue;
1430 }
1433 if (repeats)
1434 {
1435 specialMapping.TypeDesc = specialMapping.TypeDesc.CreateArrayTypeDesc();
1436 }
1437 return specialMapping;
1438 }
1439
1440 [RequiresUnreferencedCode("calls ImportSubstitutionGroupMember")]
1442 {
1443 repeats |= element.IsMultipleOccurrence;
1446 {
1447 return;
1448 }
1450 if ((elementAccessor = ImportArray(element, identifier, ns, repeats)) == null)
1451 {
1453 }
1457 if (memberMapping.Name.EndsWith("Specified", StringComparison.Ordinal))
1458 {
1462 }
1464 if (elementAccessor.Mapping.IsList)
1465 {
1467 memberMapping.TypeDesc = elementAccessor.Mapping.TypeDesc;
1468 }
1469 else
1470 {
1471 memberMapping.TypeDesc = elementAccessor.Mapping.TypeDesc;
1472 }
1475 if (element.IsMultipleOccurrence || repeats)
1476 {
1478 {
1479 elementAccessor.Mapping = ((ArrayMapping)elementAccessor.Mapping).TopLevelMapping;
1482 }
1483 memberMapping.TypeDesc = elementAccessor.Mapping.TypeDesc.CreateArrayTypeDesc();
1484 }
1485 if (element.MinOccurs == 0m && memberMapping.TypeDesc.IsValueType && !element.HasDefault && !memberMapping.TypeDesc.HasIsEmpty)
1486 {
1488 }
1489 }
1490
1491 [RequiresUnreferencedCode("calls ImportAttribute")]
1516
1517 [RequiresUnreferencedCode("calls GetTypeDesc")]
1535
1537 {
1538 xmlnsMemberName = null;
1539 if (type.Annotation == null)
1540 {
1541 return false;
1542 }
1543 if (type.Annotation.Items == null || type.Annotation.Items.Count == 0)
1544 {
1545 return false;
1546 }
1547 foreach (XmlSchemaObject item in type.Annotation.Items)
1548 {
1549 if (!(item is XmlSchemaAppInfo))
1550 {
1551 continue;
1552 }
1553 XmlNode[] markup = ((XmlSchemaAppInfo)item).Markup;
1554 if (markup == null || markup.Length == 0)
1555 {
1556 continue;
1557 }
1558 XmlNode[] array = markup;
1559 foreach (XmlNode xmlNode in array)
1560 {
1561 if (!(xmlNode is XmlElement))
1562 {
1563 continue;
1564 }
1566 if (xmlElement.Name == "keepNamespaceDeclarations")
1567 {
1568 if (xmlElement.LastNode is XmlText)
1569 {
1570 xmlnsMemberName = ((XmlText)xmlElement.LastNode).Value.Trim(null);
1571 }
1572 return true;
1573 }
1574 }
1575 }
1576 return false;
1577 }
1578
1579 [RequiresUnreferencedCode("calls GetTypeDesc")]
1603
1604 [RequiresUnreferencedCode("calls ImportAnyAttributeMember")]
1606 {
1607 for (int i = 0; i < group.Attributes.Count; i++)
1608 {
1609 object obj = group.Attributes[i];
1611 {
1613 }
1614 else if (obj is XmlSchemaAttribute)
1615 {
1617 }
1618 }
1619 if (group.AnyAttribute != null)
1620 {
1622 }
1623 }
1624
1625 [RequiresUnreferencedCode("calls GetTypeDesc")]
1627 {
1629 primitiveMapping.TypeDesc = base.Scope.GetTypeDesc(typeof(string));
1630 primitiveMapping.TypeName = primitiveMapping.TypeDesc.DataType.Name;
1632 attributeAccessor.Name = name.Name;
1633 attributeAccessor.Namespace = "http://www.w3.org/XML/1998/namespace";
1634 attributeAccessor.CheckSpecial();
1636 return attributeAccessor;
1637 }
1638
1639 [RequiresUnreferencedCode("calls ImportSpecialAttribute")]
1641 {
1642 if (attribute.Use == XmlSchemaUse.Prohibited)
1643 {
1644 return null;
1645 }
1646 if (!attribute.RefName.IsEmpty)
1647 {
1648 if (attribute.RefName.Namespace == "http://www.w3.org/XML/1998/namespace")
1649 {
1651 }
1653 }
1654 if (attribute.Name.Length == 0)
1655 {
1657 }
1659 TypeMapping typeMapping = ((!attribute.SchemaTypeName.IsEmpty) ? ImportType(attribute.SchemaTypeName, typeof(TypeMapping), null, TypeFlags.CanBeAttributeValue, addref: false) : ((attribute.SchemaType == null) ? GetDefaultMapping(TypeFlags.CanBeAttributeValue) : ImportDataType(attribute.SchemaType, ns, identifier, null, TypeFlags.CanBeAttributeValue, isList: false)));
1660 if (typeMapping != null && !typeMapping.TypeDesc.IsMappedType)
1661 {
1662 RunSchemaExtensions(typeMapping, attribute.SchemaTypeName, attribute.SchemaType, attribute, (TypeFlags)56);
1663 }
1668 attributeAccessor.CheckSpecial();
1672 if (defaultValueProvider.DefaultValue != null)
1673 {
1675 }
1676 else if (defaultValueProvider.FixedValue != null)
1677 {
1680 }
1681 else if (attribute != defaultValueProvider)
1682 {
1683 if (attribute.DefaultValue != null)
1684 {
1685 attributeAccessor.Default = attribute.DefaultValue;
1686 }
1687 else if (attribute.FixedValue != null)
1688 {
1691 }
1692 }
1693 return attributeAccessor;
1694 }
1695
1696 [RequiresUnreferencedCode("calls ImportStructDataType")]
1697 private TypeMapping ImportDataType(XmlSchemaSimpleType dataType, string typeNs, string identifier, Type baseType, TypeFlags flags, bool isList)
1698 {
1699 if (baseType != null)
1700 {
1701 return ImportStructDataType(dataType, typeNs, identifier, baseType);
1702 }
1703 TypeMapping typeMapping = ImportNonXsdPrimitiveDataType(dataType, typeNs, flags);
1704 if (typeMapping != null)
1705 {
1706 return typeMapping;
1707 }
1709 {
1712 {
1714 {
1715 return ImportEnumeratedDataType(dataType, typeNs, identifier, flags, isList);
1716 }
1717 }
1718 if (xmlSchemaSimpleTypeRestriction.BaseType != null)
1719 {
1720 return ImportDataType(xmlSchemaSimpleTypeRestriction.BaseType, typeNs, identifier, null, flags, isList: false);
1721 }
1723 typeMapping = ImportDataType(FindDataType(xmlSchemaSimpleTypeRestriction.BaseTypeName, flags), xmlSchemaSimpleTypeRestriction.BaseTypeName.Namespace, identifier, null, flags, isList: false);
1724 if (xmlSchemaSimpleTypeRestriction.BaseTypeName.Namespace != "http://www.w3.org/2001/XMLSchema")
1725 {
1726 RemoveReference(xmlSchemaSimpleTypeRestriction.BaseTypeName, base.TypesInUse);
1727 }
1728 return typeMapping;
1729 }
1731 {
1732 if (dataType.Content is XmlSchemaSimpleTypeList)
1733 {
1735 if (xmlSchemaSimpleTypeList.ItemType != null)
1736 {
1737 typeMapping = ImportDataType(xmlSchemaSimpleTypeList.ItemType, typeNs, identifier, null, flags, isList: true);
1738 if (typeMapping != null)
1739 {
1740 typeMapping.TypeName = dataType.Name;
1741 return typeMapping;
1742 }
1743 }
1744 else if (xmlSchemaSimpleTypeList.ItemTypeName != null && !xmlSchemaSimpleTypeList.ItemTypeName.IsEmpty)
1745 {
1746 typeMapping = ImportType(xmlSchemaSimpleTypeList.ItemTypeName, typeof(TypeMapping), null, TypeFlags.CanBeAttributeValue, addref: true);
1748 {
1750 return typeMapping;
1751 }
1752 }
1753 }
1754 return GetDefaultMapping(flags);
1755 }
1756 return ImportPrimitiveDataType(dataType, flags);
1757 }
1758
1759 [RequiresUnreferencedCode("calls FindType")]
1760 private TypeMapping ImportEnumeratedDataType(XmlSchemaSimpleType dataType, string typeNs, string identifier, TypeFlags flags, bool isList)
1761 {
1762 TypeMapping typeMapping = (TypeMapping)base.ImportedMappings[dataType];
1763 if (typeMapping != null)
1764 {
1765 return typeMapping;
1766 }
1767 XmlSchemaType xmlSchemaType = dataType;
1768 while (!xmlSchemaType.DerivedFrom.IsEmpty)
1769 {
1770 xmlSchemaType = FindType(xmlSchemaType.DerivedFrom, (TypeFlags)40);
1771 }
1773 {
1774 return null;
1775 }
1777 if (typeDesc != null && typeDesc.FullName != typeof(string).FullName)
1778 {
1779 return ImportPrimitiveDataType(dataType, flags);
1780 }
1784 enumMapping.IsReference = base.Schemas.IsReference(dataType);
1785 enumMapping.TypeDesc = new TypeDesc(text, text, TypeKind.Enum, null, TypeFlags.None);
1786 if (dataType.Name != null && dataType.Name.Length > 0)
1787 {
1789 }
1790 enumMapping.Namespace = typeNs;
1793 XmlSchemaSimpleTypeContent content = dataType.Content;
1795 {
1797 for (int i = 0; i < xmlSchemaSimpleTypeRestriction.Facets.Count; i++)
1798 {
1799 object obj = xmlSchemaSimpleTypeRestriction.Facets[i];
1801 {
1803 if (typeDesc != null && typeDesc.HasCustomFormatter)
1804 {
1806 }
1812 }
1813 }
1814 }
1816 if (isList && enumMapping.Constants.Length > 63)
1817 {
1819 base.ImportedMappings.Add(dataType, typeMapping);
1820 return typeMapping;
1821 }
1822 base.ImportedMappings.Add(dataType, enumMapping);
1823 base.Scope.AddTypeMapping(enumMapping);
1824 return enumMapping;
1825 }
1826
1827 private EnumMapping ImportEnumeratedChoice(ElementAccessor[] choice, string typeNs, string typeName)
1828 {
1829 typeName = GenerateUniqueTypeName(Accessor.UnescapeName(typeName), typeNs);
1831 enumMapping.TypeDesc = new TypeDesc(typeName, typeName, TypeKind.Enum, null, TypeFlags.None);
1832 enumMapping.TypeName = typeName;
1833 enumMapping.Namespace = typeNs;
1834 enumMapping.IsFlags = false;
1836 if (GenerateOrder)
1837 {
1839 }
1841 for (int i = 0; i < choice.Length; i++)
1842 {
1847 constantMapping.XmlName = elementAccessor.ToString(typeNs);
1849 }
1851 base.Scope.AddTypeMapping(enumMapping);
1852 return enumMapping;
1853 }
1854
1855 [RequiresUnreferencedCode("calls GetDataTypeSource")]
1857 {
1858 TypeDesc dataTypeSource = GetDataTypeSource(dataType, flags);
1862 primitiveMapping.Namespace = (primitiveMapping.TypeDesc.IsXsdType ? "http://www.w3.org/2001/XMLSchema" : "http://microsoft.com/wsdl/types/");
1863 return primitiveMapping;
1864 }
1865
1867 {
1869 TypeDesc typeDesc = null;
1870 if (dataType.Name != null && dataType.Name.Length != 0)
1871 {
1872 typeDesc = base.Scope.GetTypeDesc(dataType.Name, ns, flags);
1873 if (typeDesc != null)
1874 {
1877 primitiveMapping.TypeName = typeDesc.DataType.Name;
1878 primitiveMapping.Namespace = (primitiveMapping.TypeDesc.IsXsdType ? "http://www.w3.org/2001/XMLSchema" : ns);
1879 }
1880 }
1881 return primitiveMapping;
1882 }
1883
1885 {
1887 if (xmlSchemaGroup == null)
1888 {
1890 }
1891 return xmlSchemaGroup;
1892 }
1893
1903
1905 {
1906 XmlSchemaSimpleTypeContent content = dataType.Content;
1908 {
1909 return ((XmlSchemaSimpleTypeRestriction)content).BaseTypeName;
1910 }
1911 if (content is XmlSchemaSimpleTypeList)
1912 {
1914 if (xmlSchemaSimpleTypeList.ItemTypeName != null && !xmlSchemaSimpleTypeList.ItemTypeName.IsEmpty)
1915 {
1916 return xmlSchemaSimpleTypeList.ItemTypeName;
1917 }
1918 if (xmlSchemaSimpleTypeList.ItemType != null)
1919 {
1920 return BaseTypeName(xmlSchemaSimpleTypeList.ItemType);
1921 }
1922 }
1923 return new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
1924 }
1925
1926 [RequiresUnreferencedCode("calls FindDataType")]
1928 {
1929 TypeDesc typeDesc = null;
1930 if (dataType.Name != null && dataType.Name.Length != 0)
1931 {
1932 typeDesc = base.Scope.GetTypeDesc(dataType);
1933 if (typeDesc != null)
1934 {
1935 return typeDesc;
1936 }
1937 }
1941 if (xmlQualifiedName.Namespace != "http://www.w3.org/2001/XMLSchema")
1942 {
1944 }
1945 return typeDesc;
1946 }
1947
1948 [RequiresUnreferencedCode("calls GetTypeDesc")]
1950 {
1951 if (name == null || name.IsEmpty)
1952 {
1953 return (XmlSchemaSimpleType)base.Scope.GetTypeDesc(typeof(string)).DataType;
1954 }
1955 TypeDesc typeDesc = base.Scope.GetTypeDesc(name.Name, name.Namespace, flags);
1956 if (typeDesc != null && typeDesc.DataType is XmlSchemaSimpleType)
1957 {
1958 return (XmlSchemaSimpleType)typeDesc.DataType;
1959 }
1961 if (xmlSchemaSimpleType != null)
1962 {
1963 return xmlSchemaSimpleType;
1964 }
1965 if (name.Namespace == "http://www.w3.org/2001/XMLSchema")
1966 {
1967 return (XmlSchemaSimpleType)base.Scope.GetTypeDesc("string", "http://www.w3.org/2001/XMLSchema", flags).DataType;
1968 }
1969 if (name.Name == "Array" && name.Namespace == "http://schemas.xmlsoap.org/soap/encoding/")
1970 {
1972 }
1974 }
1975
1976 [RequiresUnreferencedCode("calls GetTypeDesc")]
1978 {
1979 if (name == null || name.IsEmpty)
1980 {
1981 return base.Scope.GetTypeDesc(typeof(string)).DataType;
1982 }
1983 object obj = base.Schemas.Find(name, typeof(XmlSchemaComplexType));
1984 if (obj != null)
1985 {
1986 return (XmlSchemaComplexType)obj;
1987 }
1988 return FindDataType(name, flags);
1989 }
1990
1992 {
1994 if (xmlSchemaElement == null)
1995 {
1997 }
1998 return xmlSchemaElement;
1999 }
2000
2010
2011 private XmlSchemaForm ElementForm(string ns, XmlSchemaElement element)
2012 {
2013 if (element.Form == XmlSchemaForm.None)
2014 {
2016 while (xmlSchemaObject.Parent != null)
2017 {
2019 }
2021 {
2022 if (ns == null || ns.Length == 0)
2023 {
2024 if (xmlSchema.ElementFormDefault != 0)
2025 {
2026 return xmlSchema.ElementFormDefault;
2027 }
2028 return XmlSchemaForm.Unqualified;
2029 }
2031 if (element.QualifiedName.Namespace != null && element.QualifiedName.Namespace.Length != 0)
2032 {
2033 return XmlSchemaForm.Qualified;
2034 }
2035 return XmlSchemaForm.Unqualified;
2036 }
2037 return XmlSchemaForm.Qualified;
2038 }
2039 return element.Form;
2040 }
2041
2043 {
2044 if (attribute.Form == XmlSchemaForm.None)
2045 {
2047 while (xmlSchemaObject.Parent != null)
2048 {
2050 }
2052 {
2053 if (ns == null || ns.Length == 0)
2054 {
2055 if (xmlSchema.AttributeFormDefault != 0)
2056 {
2057 return xmlSchema.AttributeFormDefault;
2058 }
2059 return XmlSchemaForm.Unqualified;
2060 }
2062 if (attribute.QualifiedName.Namespace != null && attribute.QualifiedName.Namespace.Length != 0)
2063 {
2064 return XmlSchemaForm.Qualified;
2065 }
2066 return XmlSchemaForm.Unqualified;
2067 }
2068 return XmlSchemaForm.Unqualified;
2069 }
2070 return attribute.Form;
2071 }
2072}
static void Sort(Array array)
Definition Array.cs:2329
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
virtual ICollection Values
Definition Hashtable.cs:534
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
static CultureInfo InvariantCulture
static string XmlElementHasNoName
Definition SR.cs:1482
static string XmlTypeUsedTwice
Definition SR.cs:1494
static string XmlMembersDeriveError
Definition SR.cs:1492
static string XmlMissingDataType
Definition SR.cs:1500
static string XmlBadBaseType
Definition SR.cs:1638
static string XmlInternalError
Definition SR.cs:1812
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlMissingAttribute
Definition SR.cs:1506
static string XmlBadBaseElement
Definition SR.cs:1636
static string XmlCircularGroupReference
Definition SR.cs:1726
static string XmlMissingAttributeGroup
Definition SR.cs:1498
static string XmlInvalidEncoding
Definition SR.cs:1502
static string XmlElementImportedTwice
Definition SR.cs:1486
static string XmlDuplicateElementInScope1
Definition SR.cs:1710
static string XmlMissingGroup
Definition SR.cs:1496
static string XmlAttributeHasNoName
Definition SR.cs:1484
static string XmlMissingElement
Definition SR.cs:1504
static string XmlUnsupportedRedefine
Definition SR.cs:1706
static string XmlDuplicateElementInScope
Definition SR.cs:1708
static string XmlIllegalOverride
Definition SR.cs:1622
static string XmlCircularTypeReference
Definition SR.cs:1724
Definition SR.cs:7
static string UnescapeName(string name)
Definition Accessor.cs:191
static string EscapeName(string name)
Definition Accessor.cs:162
static string MakePascal(string identifier)
static string MakeValid(string identifier)
void MakeDerived(StructMapping structMapping, Type baseType, bool baseTypeCanBeIndirect)
void RemoveReference(XmlQualifiedName name, NameTable references)
void AddReference(XmlQualifiedName name, NameTable references, string error)
void AddReservedIdentifiersForDataBinding(CodeIdentifiers scope)
static TypeDesc FindCommonBaseTypeDesc(TypeDesc[] typeDescs)
Definition TypeDesc.cs:335
static object ToDefaultValue(string value, string formatter)
MembersMapping ImportMembersType(XmlSchemaType type, string typeNs, string identifier)
static XmlQualifiedName BaseTypeName(XmlSchemaSimpleType dataType)
XmlMembersMapping ImportMembersMapping(XmlQualifiedName[] names)
void ImportAttributeGroupMembers(XmlSchemaAttributeGroup group, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, string ns)
TypeMapping ImportType(XmlQualifiedName name, Type desiredMappingType, Type baseType, TypeFlags flags, bool addref)
void ImportXmlnsDeclarationsMember(XmlSchemaType type, CodeIdentifiers members, CodeIdentifiers membersScope)
AttributeAccessor ImportSpecialAttribute(XmlQualifiedName name, string identifier)
static bool IsMixed(XmlSchemaType type)
XmlMembersMapping? ImportAnyType(XmlQualifiedName typeName, string elementName)
TypeDesc GetDataTypeSource(XmlSchemaSimpleType dataType, TypeFlags flags)
ElementAccessor ImportArray(XmlSchemaElement element, string identifier, string ns, bool repeats)
bool ImportSubstitutionGroupMember(XmlSchemaElement element, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, string ns, bool repeats, ref bool needExplicitOrder, bool allowDuplicates)
bool KeepXmlnsDeclarations(XmlSchemaType type, out string xmlnsMemberName)
XmlTypeMapping ImportSchemaType(XmlQualifiedName typeName)
XmlSchemaElement[] GetEquivalentElements(XmlSchemaElement element)
XmlSchemaSimpleType FindDataType(XmlQualifiedName name, TypeFlags flags)
TypeMapping ImportEnumeratedDataType(XmlSchemaSimpleType dataType, string typeNs, string identifier, TypeFlags flags, bool isList)
void RunSchemaExtensions(TypeMapping mapping, XmlQualifiedName qname, XmlSchemaType type, XmlSchemaObject context, TypeFlags flags)
MemberMapping[] ImportTypeMembers(XmlSchemaType type, string typeNs, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, ref bool needExplicitOrder, bool order, bool allowUnboundedElements)
TypeMapping ImportElementType(XmlSchemaElement element, string identifier, Type desiredMappingType, Type baseType, string ns)
void AddScopeElement(INameScope scope, ElementAccessor element, ref bool duplicateElements, bool allowDuplicates)
TypeMapping GetDefaultMapping(TypeFlags flags)
XmlTypeMapping ImportTypeMapping(XmlQualifiedName name)
XmlTypeMapping ImportDerivedTypeMapping(XmlQualifiedName name, Type? baseType)
XmlSchemaForm AttributeForm(string ns, XmlSchemaAttribute attribute)
TypeMapping ImportType(XmlSchemaComplexType type, string typeNs, string identifier, Type desiredMappingType, Type baseType, TypeFlags flags)
ElementAccessor ImportElement(XmlQualifiedName name, Type desiredMappingType, Type baseType)
XmlSchemaAttribute FindAttribute(XmlQualifiedName name)
EnumMapping ImportEnumeratedChoice(ElementAccessor[] choice, string typeNs, string typeName)
XmlTypeMapping ImportDerivedTypeMapping(XmlQualifiedName name, Type? baseType, bool baseTypeCanBeIndirect)
PrimitiveMapping ImportNonXsdPrimitiveDataType(XmlSchemaSimpleType dataType, string ns, TypeFlags flags)
TypeItems GetTypeItems(XmlSchemaType type)
MemberMapping ImportAnyMember(XmlSchemaAny any, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string ns, ref bool mixed, ref bool needExplicitOrder, bool allowDuplicates)
StructMapping ImportStructType(XmlSchemaType type, string typeNs, string identifier, Type baseType, bool arrayLike)
XmlMembersMapping ImportMembersMapping(string name, string? ns, SoapSchemaMember[] members)
XmlSchemaGroup FindGroup(XmlQualifiedName name)
ArrayMapping ImportArrayMapping(XmlSchemaType type, string identifier, string ns, bool repeats)
override void ImportDerivedTypes(XmlQualifiedName baseName)
XmlSchemaAttributeGroup FindAttributeGroup(XmlQualifiedName name)
bool IsCyclicReferencedType(XmlSchemaElement element, List< string > identifiers)
XmlTypeMapping ImportSchemaType(XmlQualifiedName typeName, Type? baseType)
void ImportAttributeMember(XmlSchemaAttribute attribute, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, string ns)
XmlMembersMapping ImportMembersMapping(XmlQualifiedName[] names, Type? baseType, bool baseTypeCanBeIndirect)
XmlSchemaType FindType(XmlQualifiedName name, TypeFlags flags)
void ImportGroup(XmlSchemaGroupBase group, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string ns, bool mixed, ref bool needExplicitOrder, bool allowDuplicates, bool groupRepeats, bool allowUnboundedElements)
bool GatherGroupChoices(XmlSchemaGroup group, NameTable choiceElements, string identifier, string ns, ref bool needExplicitOrder, bool allowDuplicates)
ElementAccessor ImportElement(XmlSchemaElement element, string identifier, Type desiredMappingType, Type baseType, string ns, bool topLevelElement)
XmlSchemaImporter(XmlSchemas schemas, CodeIdentifiers? typeIdentifiers)
StructMapping ImportStructDataType(XmlSchemaSimpleType dataType, string typeNs, string identifier, Type baseType)
void AddScopeElements(INameScope scope, ElementAccessor[] elements, ref bool duplicateElements, bool allowDuplicates)
XmlMembersMapping ImportMembersMapping(XmlQualifiedName name)
void ImportTextMember(CodeIdentifiers members, CodeIdentifiers membersScope, XmlQualifiedName simpleContentType)
void ImportAnyAttributeMember(XmlSchemaAnyAttribute any, CodeIdentifiers members, CodeIdentifiers membersScope)
ElementAccessor[] ImportAny(XmlSchemaAny any, bool makeElement, string targetNamespace)
XmlSchemaElement FindElement(XmlQualifiedName name)
MemberMapping ImportChoiceGroup(XmlSchemaGroupBase group, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string ns, bool groupRepeats, ref bool needExplicitOrder, bool allowDuplicates)
bool GatherGroupChoices(XmlSchemaParticle particle, NameTable choiceElements, string identifier, string ns, ref bool needExplicitOrder, bool allowDuplicates)
XmlTypeMapping ImportSchemaType(XmlQualifiedName typeName, Type? baseType, bool baseTypeCanBeIndirect)
XmlSchemaForm ElementForm(string ns, XmlSchemaElement element)
SpecialMapping ImportAnyMapping(XmlSchemaType type, string identifier, string ns, bool repeats)
AttributeAccessor ImportAttribute(XmlSchemaAttribute attribute, string identifier, string ns, XmlSchemaAttribute defaultValueProvider)
bool IsNeedXmlSerializationAttributes(ArrayMapping arrayMapping)
void ImportElementMember(XmlSchemaElement element, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string ns, bool repeats, ref bool needExplicitOrder, bool allowDuplicates, bool allowUnboundedElements)
string GenerateUniqueTypeName(string desiredName, string ns)
void ImportGroupMembers(XmlSchemaParticle particle, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string ns, bool groupRepeats, ref bool mixed, ref bool needExplicitOrder, bool allowDuplicates, bool allowUnboundedElements)
TypeMapping ImportDataType(XmlSchemaSimpleType dataType, string typeNs, string identifier, Type baseType, TypeFlags flags, bool isList)
PrimitiveMapping ImportPrimitiveDataType(XmlSchemaSimpleType dataType, TypeFlags flags)
XmlSchemaElement GetTopLevelElement(XmlSchemaElement element)
static void Preprocess(XmlSchema schema)
static XmlQualifiedName GetParentName(XmlSchemaObject item)
static bool IsDataSet(XmlSchema schema)
static readonly XmlQualifiedName Empty