Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlReflectionImporter.cs
Go to the documentation of this file.
7
9
11{
12 private enum ImportContext
13 {
14 Text,
17 }
18
19 private readonly TypeScope _typeScope;
20
22
24
25 private readonly NameTable _types = new NameTable();
26
27 private readonly NameTable _nullables = new NameTable();
28
29 private readonly NameTable _elements = new NameTable();
30
32
34
35 private readonly Hashtable _anonymous = new Hashtable();
36
38
40
41 private readonly string _defaultNs;
42
43 private readonly ModelScope _modelScope;
44
45 private int _arrayNestingLevel;
46
48
49 private string _savedArrayNamespace;
50
51 private int _choiceNum = 1;
52
54 : this(null, null)
55 {
56 }
57
58 public XmlReflectionImporter(string? defaultNamespace)
59 : this(null, defaultNamespace)
60 {
61 }
62
67
69 {
70 if (defaultNamespace == null)
71 {
72 defaultNamespace = string.Empty;
73 }
74 if (attributeOverrides == null)
75 {
77 }
79 _defaultNs = defaultNamespace;
80 _typeScope = new TypeScope();
82 }
83
84 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
89
90 [RequiresUnreferencedCode("calls IncludeType")]
92 {
93 object[] customAttributes = provider.GetCustomAttributes(typeof(XmlIncludeAttribute), inherit: false);
94 for (int i = 0; i < customAttributes.Length; i++)
95 {
98 }
99 }
100
101 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
102 public void IncludeType(Type type)
103 {
105 }
106
107 [RequiresUnreferencedCode("calls ImportTypeMapping")]
125
126 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
128 {
129 return ImportTypeMapping(type, null, null);
130 }
131
132 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
133 public XmlTypeMapping ImportTypeMapping(Type type, string? defaultNamespace)
134 {
135 return ImportTypeMapping(type, null, defaultNamespace);
136 }
137
138 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
140 {
141 return ImportTypeMapping(type, root, null);
142 }
143
144 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
145 public XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute? root, string? defaultNamespace)
146 {
147 if (type == null)
148 {
149 throw new ArgumentNullException("type");
150 }
152 xmlTypeMapping.SetKeyInternal(XmlMapping.GenerateKey(type, root, defaultNamespace));
154 return xmlTypeMapping;
155 }
156
157 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
159 {
160 return ImportMembersMapping(elementName, ns, members, hasWrapperElement, rpc: false);
161 }
162
163 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
164 public XmlMembersMapping ImportMembersMapping(string? elementName, string? ns, XmlReflectionMember[] members, bool hasWrapperElement, bool rpc)
165 {
166 return ImportMembersMapping(elementName, ns, members, hasWrapperElement, rpc, openModel: false);
167 }
168
169 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
170 public XmlMembersMapping ImportMembersMapping(string? elementName, string? ns, XmlReflectionMember[] members, bool hasWrapperElement, bool rpc, bool openModel)
171 {
173 }
174
175 [RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly")]
205
207 {
209 if (xmlAttributes != null)
210 {
211 return xmlAttributes;
212 }
214 {
215 return _defaultAttributes;
216 }
217 return new XmlAttributes(type);
218 }
219
221 {
223 if (xmlAttributes != null)
224 {
225 return xmlAttributes;
226 }
227 return new XmlAttributes(memberInfo);
228 }
229
230 [RequiresUnreferencedCode("calls ImportTypeMapping")]
232 {
233 XmlAttributes attributes = GetAttributes(model.Type, canBeSimpleType: true);
234 if (root == null)
235 {
236 root = attributes.XmlRoot;
237 }
238 string text = root?.Namespace;
239 if (text == null)
240 {
241 text = defaultNamespace;
242 }
243 if (text == null)
244 {
246 }
251 if (root != null)
252 {
253 if (root.ElementName.Length > 0)
254 {
256 }
257 if (root.GetIsNullableSpecified() && !root.IsNullable && model.TypeDesc.IsOptionalValue)
258 {
259 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidNotNullable, model.TypeDesc.BaseTypeDesc.FullName, "XmlRoot"));
260 }
262 CheckNullable(elementAccessor.IsNullable, model.TypeDesc, elementAccessor.Mapping);
263 }
264 else
265 {
266 elementAccessor.IsNullable = model.TypeDesc.IsNullable || model.TypeDesc.IsOptionalValue;
267 }
270 }
271
272 private static string GetMappingName(Mapping mapping)
273 {
275 {
276 return "(method)";
277 }
279 {
280 return ((TypeMapping)mapping).TypeDesc.FullName;
281 }
282 throw new ArgumentException(System.SR.XmlInternalError, "mapping");
283 }
284
286 {
287 if (accessor.Namespace == ns)
288 {
289 return accessor;
290 }
292 }
293
295 {
296 if (accessor.Any && accessor.Name.Length == 0)
297 {
298 return accessor;
299 }
301 if (accessor2 == null)
302 {
304 accessors.Add(accessor.Name, accessor.Namespace, accessor);
305 return accessor;
306 }
307 if (accessor2.Mapping == accessor.Mapping)
308 {
309 return accessor2;
310 }
311 if (!(accessor.Mapping is MembersMapping) && !(accessor2.Mapping is MembersMapping) && (accessor.Mapping.TypeDesc == accessor2.Mapping.TypeDesc || (accessor2.Mapping is NullableMapping && accessor.Mapping.TypeDesc == ((NullableMapping)accessor2.Mapping).BaseMapping.TypeDesc) || (accessor.Mapping is NullableMapping && ((NullableMapping)accessor.Mapping).BaseMapping.TypeDesc == accessor2.Mapping.TypeDesc)))
312 {
315 if (text == text2)
316 {
317 return accessor2;
318 }
320 }
321 if (accessor.Mapping is MembersMapping || accessor2.Mapping is MembersMapping)
322 {
324 }
325 if (accessor.Mapping is ArrayMapping)
326 {
327 if (!(accessor2.Mapping is ArrayMapping))
328 {
330 }
334 while (arrayMapping2 != null)
335 {
336 if (arrayMapping2 == accessor.Mapping)
337 {
338 return accessor2;
339 }
341 }
342 arrayMapping.Next = next;
343 if (!arrayMapping.IsAnonymousType)
344 {
345 _types[accessor2.Mapping.TypeName, accessor2.Mapping.Namespace] = arrayMapping;
346 }
347 return accessor2;
348 }
350 {
352 }
354 }
355
357 {
359 }
360
362 {
364 }
365
370
371 [RequiresUnreferencedCode("calls ImportTypeMapping")]
373 {
374 return ImportTypeMapping(model, ns, context, dataType, a, repeats: false, openModel: false, limiter);
375 }
376
377 [RequiresUnreferencedCode("calls ImportEnumMapping")]
379 {
380 try
381 {
382 if (dataType.Length > 0)
383 {
385 if (!typeDesc.IsPrimitive)
386 {
387 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidDataTypeUsage, dataType, "XmlElementAttribute.DataType"));
388 }
389 TypeDesc typeDesc2 = _typeScope.GetTypeDesc(dataType, "http://www.w3.org/2001/XMLSchema");
390 if (typeDesc2 == null)
391 {
392 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidXsdDataType, dataType, "XmlElementAttribute.DataType", new XmlQualifiedName(dataType, "http://www.w3.org/2001/XMLSchema").ToString()));
393 }
394 if (typeDesc.FullName != typeDesc2.FullName)
395 {
396 throw new InvalidOperationException(System.SR.Format(System.SR.XmlDataTypeMismatch, dataType, "XmlElementAttribute.DataType", typeDesc.FullName));
397 }
398 }
399 if (a == null)
400 {
401 a = GetAttributes(model.Type, canBeSimpleType: false);
402 }
403 if (((uint)a.XmlFlags & 0xFFFFFF3Fu) != 0)
404 {
406 }
407 switch (model.TypeDesc.Kind)
408 {
409 case TypeKind.Enum:
411 case TypeKind.Primitive:
412 if (a.XmlFlags != 0)
413 {
415 }
416 return ImportPrimitiveMapping((PrimitiveModel)model, context, dataType, repeats);
417 case TypeKind.Array:
418 case TypeKind.Collection:
419 case TypeKind.Enumerable:
420 {
421 if (context != ImportContext.Element)
422 {
423 throw UnsupportedException(model.TypeDesc, context);
424 }
428 return result;
429 }
430 case TypeKind.Root:
431 case TypeKind.Struct:
432 case TypeKind.Class:
433 if (context != ImportContext.Element)
434 {
435 throw UnsupportedException(model.TypeDesc, context);
436 }
437 if (model.TypeDesc.IsOptionalValue)
438 {
439 TypeDesc typeDesc3 = (string.IsNullOrEmpty(dataType) ? model.TypeDesc.BaseTypeDesc : _typeScope.GetTypeDesc(dataType, "http://www.w3.org/2001/XMLSchema"));
440 string typeName = ((typeDesc3.DataType == null) ? typeDesc3.Name : typeDesc3.DataType.Name);
441 TypeMapping typeMapping = GetTypeMapping(typeName, ns, typeDesc3, _types, null);
442 if (typeMapping == null)
443 {
444 typeMapping = ImportTypeMapping(_modelScope.GetTypeModel(model.TypeDesc.BaseTypeDesc.Type), ns, context, dataType, null, repeats, openModel, limiter);
445 }
446 return CreateNullableMapping(typeMapping, model.TypeDesc.Type);
447 }
449 default:
450 if (model.TypeDesc.Kind == TypeKind.Serializable)
451 {
452 if (((uint)a.XmlFlags & 0xFFFFFFBFu) != 0)
453 {
454 throw new InvalidOperationException(System.SR.Format(System.SR.XmlSerializableAttributes, model.TypeDesc.FullName, "XmlSchemaProviderAttribute"));
455 }
456 }
457 else if (a.XmlFlags != 0)
458 {
460 }
461 if (model.TypeDesc.IsSpecial)
462 {
463 return ImportSpecialMapping(model.Type, model.TypeDesc, ns, context, limiter);
464 }
465 throw UnsupportedException(model.TypeDesc, context);
466 }
467 }
468 catch (Exception ex)
469 {
471 {
472 throw;
473 }
474 throw CreateTypeReflectionException(model.TypeDesc.FullName, ex);
475 }
476 }
477
479 {
480 if (provider.IsAny)
481 {
482 return null;
483 }
484 if (provider.MethodName == null)
485 {
486 throw new ArgumentNullException("MethodName");
487 }
489 {
490 throw new ArgumentException(System.SR.Format(System.SR.XmlGetSchemaMethodName, provider.MethodName), "MethodName");
491 }
492 MethodInfo method = (method = type.GetMethod(provider.MethodName, BindingFlags.Static | BindingFlags.Public, new Type[1] { typeof(XmlSchemaSet) }));
493 if (method == null)
494 {
495 throw new InvalidOperationException(System.SR.Format(System.SR.XmlGetSchemaMethodMissing, provider.MethodName, "XmlSchemaSet", type.FullName));
496 }
497 if (!typeof(XmlQualifiedName).IsAssignableFrom(method.ReturnType) && !typeof(XmlSchemaType).IsAssignableFrom(method.ReturnType))
498 {
500 }
501 return method;
502 }
503
504 [RequiresUnreferencedCode("calls IncludeTypes")]
506 {
507 if (_specials == null)
508 {
509 _specials = new Hashtable();
510 }
512 if (specialMapping != null)
513 {
514 CheckContext(specialMapping.TypeDesc, context);
515 return specialMapping;
516 }
517 if (typeDesc.Kind == TypeKind.Serializable)
518 {
520 object[] customAttributes = type.GetCustomAttributes(typeof(XmlSchemaProviderAttribute), inherit: false);
521 if (customAttributes.Length != 0)
522 {
527 if (xsiType != null && !xsiType.IsEmpty)
528 {
529 if (_serializables == null)
530 {
532 }
534 if (serializableMapping2 != null)
535 {
536 if (serializableMapping2.Type == null)
537 {
539 }
540 else if (serializableMapping2.Type != type)
541 {
545 }
546 }
547 else
548 {
550 if (xsdType != null)
551 {
552 SetBase(serializableMapping, xsdType.DerivedFrom);
553 }
555 }
558 }
562 }
563 else
564 {
568 }
570 }
571 else
572 {
575 }
576 CheckContext(typeDesc, context);
579 return specialMapping;
580 }
581
583 {
584 if (!baseQname.IsEmpty && !(baseQname.Namespace == "http://www.w3.org/2001/XMLSchema"))
585 {
586 XmlSchemaSet schemas = mapping.Schemas;
587 ArrayList arrayList = (ArrayList)schemas.Schemas(baseQname.Namespace);
588 if (arrayList.Count == 0)
589 {
591 }
592 if (arrayList.Count > 1)
593 {
594 throw new InvalidOperationException(System.SR.Format(System.SR.XmlGetSchemaInclude, baseQname.Namespace, "IXmlSerializable", "GetSchema"));
595 }
599 if (_serializables[baseQname] == null)
600 {
604 }
606 }
607 }
608
609 private static string GetContextName(ImportContext context)
610 {
611 return context switch
612 {
613 ImportContext.Element => "element",
614 ImportContext.Attribute => "attribute",
615 ImportContext.Text => "text",
616 _ => throw new ArgumentException(System.SR.XmlInternalError, "context"),
617 };
618 }
619
624
629
630 [RequiresUnreferencedCode("calls GetTypeDesc")]
642
644 {
645 TypeDesc nullableTypeDesc = baseMapping.TypeDesc.GetNullableTypeDesc(type);
648 if (typeMapping != null)
649 {
651 {
654 {
655 return nullableMapping;
656 }
657 if (nullableMapping.BaseMapping == baseMapping)
658 {
659 return nullableMapping;
660 }
662 }
664 }
671 if (!baseMapping.IsAnonymousType)
672 {
674 }
675 else
676 {
678 }
680 return nullableMapping;
681 }
682
683 [RequiresUnreferencedCode("calls CreateRootMapping")]
685 {
686 if (_root == null)
687 {
690 }
691 return _root;
692 }
693
694 private TypeMapping GetTypeMapping(string typeName, string ns, TypeDesc typeDesc, NameTable typeLib, Type type)
695 {
696 TypeMapping typeMapping = ((typeName != null && typeName.Length != 0) ? ((TypeMapping)typeLib[typeName, ns]) : ((type == null) ? null : ((TypeMapping)_anonymous[type])));
697 if (typeMapping == null)
698 {
699 return null;
700 }
701 if (!typeMapping.IsAnonymousType && typeMapping.TypeDesc != typeDesc)
702 {
703 throw new InvalidOperationException(System.SR.Format(System.SR.XmlTypesDuplicate, typeDesc.FullName, typeMapping.TypeDesc.FullName, typeName, ns));
704 }
705 return typeMapping;
706 }
707
708 [RequiresUnreferencedCode("calls GetRootMapping")]
710 {
711 if (model.TypeDesc.Kind == TypeKind.Root)
712 {
713 return GetRootMapping();
714 }
715 if (a == null)
716 {
717 a = GetAttributes(model.Type, canBeSimpleType: false);
718 }
719 string text = ns;
720 if (a.XmlType != null && a.XmlType.Namespace != null)
721 {
722 text = a.XmlType.Namespace;
723 }
724 else if (a.XmlRoot != null && a.XmlRoot.Namespace != null)
725 {
726 text = a.XmlRoot.Namespace;
727 }
728 string name = (IsAnonymousType(a, ns) ? null : XsdTypeName(model.Type, a, model.TypeDesc.Name));
729 name = XmlConvert.EncodeLocalName(name);
731 if (structMapping == null)
732 {
734 structMapping.TypeDesc = model.TypeDesc;
737 if (!structMapping.IsAnonymousType)
738 {
740 }
741 else
742 {
744 }
745 if (a.XmlType != null)
746 {
747 structMapping.IncludeInSchema = a.XmlType.IncludeInSchema;
748 }
749 if (limiter.IsExceededLimit)
750 {
751 limiter.DeferredWorkItems.Add(new ImportStructWorkItem(model, structMapping));
752 return structMapping;
753 }
754 limiter.Depth++;
756 while (limiter.DeferredWorkItems.Count > 0)
757 {
761 {
762 limiter.DeferredWorkItems.RemoveAt(index);
763 }
764 }
765 limiter.Depth--;
766 }
767 return structMapping;
768 }
769
770 [RequiresUnreferencedCode("calls GetTypeModel")]
772 {
773 if (mapping.IsFullyInitialized)
774 {
775 return true;
776 }
777 if (model.TypeDesc.BaseTypeDesc != null)
778 {
780 if (!(typeModel is StructModel))
781 {
782 throw new NotSupportedException(System.SR.Format(System.SR.XmlUnsupportedInheritance, model.Type.BaseType.FullName));
783 }
785 int num = limiter.DeferredWorkItems.IndexOf(structMapping);
786 if (num >= 0)
787 {
788 if (!limiter.DeferredWorkItems.Contains(mapping))
789 {
790 limiter.DeferredWorkItems.Add(new ImportStructWorkItem(model, mapping));
791 }
793 if (num < num2)
794 {
795 ImportStructWorkItem value = limiter.DeferredWorkItems[num];
796 limiter.DeferredWorkItems[num] = limiter.DeferredWorkItems[num2];
797 limiter.DeferredWorkItems[num2] = value;
798 }
799 return false;
800 }
802 ICollection values = mapping.BaseMapping.LocalAttributes.Values;
803 foreach (AttributeAccessor item in values)
804 {
805 AddUniqueAccessor(mapping.LocalAttributes, item);
806 }
807 if (!mapping.BaseMapping.HasExplicitSequence())
808 {
809 values = mapping.BaseMapping.LocalElements.Values;
810 foreach (ElementAccessor item2 in values)
811 {
812 AddUniqueAccessor(mapping.LocalElements, item2);
813 }
814 }
815 }
818 bool hasElements = false;
819 bool flag = false;
820 MemberInfo[] memberInfos = model.GetMemberInfos();
821 foreach (MemberInfo memberInfo in memberInfos)
822 {
824 {
825 continue;
826 }
828 if (attributes.XmlIgnore)
829 {
830 continue;
831 }
832 FieldModel fieldModel = model.GetFieldModel(memberInfo);
833 if (fieldModel == null)
834 {
835 continue;
836 }
837 try
838 {
840 if (memberMapping == null || (mapping.BaseMapping != null && mapping.BaseMapping.Declares(memberMapping, mapping.TypeName)))
841 {
842 continue;
843 }
844 flag |= memberMapping.IsSequence;
845 AddUniqueAccessor(memberMapping, mapping.LocalElements, mapping.LocalAttributes, flag);
846 if (memberMapping.Text != null)
847 {
848 if (!memberMapping.Text.Mapping.TypeDesc.CanBeTextValue && memberMapping.Text.Mapping.IsList)
849 {
850 throw new InvalidOperationException(System.SR.Format(System.SR.XmlIllegalTypedTextAttribute, typeName, memberMapping.Text.Name, memberMapping.Text.Mapping.TypeDesc.FullName));
851 }
852 if (textAccessor != null)
853 {
855 }
857 }
858 if (memberMapping.Xmlns != null)
859 {
860 if (mapping.XmlnsMember != null)
861 {
863 }
865 }
866 if (memberMapping.Elements != null && memberMapping.Elements.Length != 0)
867 {
868 hasElements = true;
869 }
871 }
872 catch (Exception ex)
873 {
875 {
876 throw;
877 }
879 }
880 }
881 mapping.SetContentModel(textAccessor, hasElements);
882 if (flag)
883 {
884 Hashtable hashtable = new Hashtable();
885 for (int j = 0; j < list.Count; j++)
886 {
888 if (memberMapping2.IsParticle)
889 {
890 if (!memberMapping2.IsSequence)
891 {
893 }
894 if (hashtable[memberMapping2.SequenceId] != null)
895 {
897 }
898 hashtable[memberMapping2.SequenceId] = memberMapping2;
899 }
900 }
901 list.Sort(new MemberMappingComparer());
902 }
903 mapping.Members = list.ToArray();
904 if (mapping.BaseMapping == null)
905 {
907 }
908 if (mapping.XmlnsMember != null && mapping.BaseMapping.HasXmlnsMember)
909 {
911 }
914 if (openModel)
915 {
916 mapping.IsOpenModel = true;
917 }
918 return true;
919 }
920
921 private static bool IsAnonymousType(XmlAttributes a, string contextNs)
922 {
923 if (a.XmlType != null && a.XmlType.AnonymousType)
924 {
925 string @namespace = a.XmlType.Namespace;
926 if (!string.IsNullOrEmpty(@namespace))
927 {
928 return @namespace == contextNs;
929 }
930 return true;
931 }
932 return false;
933 }
934
935 [RequiresUnreferencedCode("calls GetTypeDesc")]
936 internal string XsdTypeName(Type type)
937 {
938 if (type == typeof(object))
939 {
940 return "anyType";
941 }
943 if (typeDesc.IsPrimitive && typeDesc.DataType != null && typeDesc.DataType.Name != null && typeDesc.DataType.Name.Length > 0)
944 {
945 return typeDesc.DataType.Name;
946 }
948 }
949
950 [RequiresUnreferencedCode("Calls XsdTypeName")]
951 internal string XsdTypeName(Type type, XmlAttributes a, string name)
952 {
953 string text = name;
954 if (a.XmlType != null && a.XmlType.TypeName.Length > 0)
955 {
956 text = a.XmlType.TypeName;
957 }
958 if (type.IsGenericType && text.Contains('{'))
959 {
960 Type genericTypeDefinition = type.GetGenericTypeDefinition();
961 Type[] genericArguments = genericTypeDefinition.GetGenericArguments();
962 Type[] genericArguments2 = type.GetGenericArguments();
963 for (int i = 0; i < genericArguments.Length; i++)
964 {
965 string text2 = "{" + genericArguments[i]?.ToString() + "}";
966 if (text.Contains(text2))
967 {
969 if (!text.Contains('{'))
970 {
971 break;
972 }
973 }
974 }
975 }
976 return text;
977 }
978
979 private static int CountAtLevel(XmlArrayItemAttributes attributes, int level)
980 {
981 int num = 0;
982 for (int i = 0; i < attributes.Count; i++)
983 {
984 if (attributes[i].NestingLevel == level)
985 {
986 num++;
987 }
988 }
989 return num;
990 }
991
992 [RequiresUnreferencedCode("calls XsdTypeName")]
993 private void SetArrayMappingType(ArrayMapping mapping, string defaultNs, Type type)
994 {
995 XmlAttributes attributes = GetAttributes(type, canBeSimpleType: false);
996 if (IsAnonymousType(attributes, defaultNs))
997 {
998 mapping.TypeName = null;
999 mapping.Namespace = defaultNs;
1000 return;
1001 }
1004 if (mapping.Elements.Length == 1)
1005 {
1006 elementAccessor = mapping.Elements[0];
1007 typeMapping = elementAccessor.Mapping;
1008 }
1009 else
1010 {
1011 typeMapping = null;
1012 }
1013 bool flag = true;
1014 string text;
1015 string name;
1016 if (attributes.XmlType != null)
1017 {
1018 text = attributes.XmlType.Namespace;
1019 name = XsdTypeName(type, attributes, attributes.XmlType.TypeName);
1020 name = XmlConvert.EncodeLocalName(name);
1021 flag = name == null;
1022 }
1023 else if (typeMapping is EnumMapping)
1024 {
1025 text = typeMapping.Namespace;
1026 name = typeMapping.DefaultElementName;
1027 }
1029 {
1030 text = defaultNs;
1031 name = typeMapping.TypeDesc.DataType.Name;
1032 }
1033 else if (typeMapping is StructMapping && typeMapping.TypeDesc.IsRoot)
1034 {
1035 text = defaultNs;
1036 name = "anyType";
1037 }
1038 else if (typeMapping != null)
1039 {
1040 text = ((typeMapping.Namespace == "http://www.w3.org/2001/XMLSchema") ? defaultNs : typeMapping.Namespace);
1041 name = typeMapping.DefaultElementName;
1042 }
1043 else
1044 {
1045 text = defaultNs;
1046 name = "Choice" + _choiceNum++;
1047 }
1048 if (name == null)
1049 {
1050 name = "Any";
1051 }
1052 if (elementAccessor != null)
1053 {
1054 text = elementAccessor.Namespace;
1055 }
1056 if (text == null)
1057 {
1058 text = defaultNs;
1059 }
1060 string text2 = (name = (flag ? ("ArrayOf" + CodeIdentifier.MakePascal(name)) : name));
1061 int num = 1;
1063 while (typeMapping2 != null)
1064 {
1066 {
1068 if (AccessorMapping.ElementsMatch(arrayMapping.Elements, mapping.Elements))
1069 {
1070 break;
1071 }
1072 }
1073 text2 = name + num.ToString(CultureInfo.InvariantCulture);
1075 num++;
1076 }
1079 }
1080
1081 [RequiresUnreferencedCode("calls SetArrayMappingType")]
1083 {
1085 arrayMapping.TypeDesc = model.TypeDesc;
1086 if (_savedArrayItemAttributes == null)
1087 {
1089 }
1091 {
1093 }
1096 for (int i = 0; i < arrayMapping.Elements.Length; i++)
1097 {
1098 arrayMapping.Elements[i] = ReconcileLocalAccessor(arrayMapping.Elements[i], arrayMapping.Namespace);
1099 }
1100 IncludeTypes(model.Type);
1102 if (arrayMapping2 != null)
1103 {
1105 while (arrayMapping2 != null)
1106 {
1107 if (arrayMapping2.TypeDesc == model.TypeDesc)
1108 {
1109 return arrayMapping2;
1110 }
1112 }
1113 arrayMapping.Next = next;
1114 if (!arrayMapping.IsAnonymousType)
1115 {
1116 _types[arrayMapping.TypeName, arrayMapping.Namespace] = arrayMapping;
1117 }
1118 else
1119 {
1121 }
1122 return arrayMapping;
1123 }
1125 if (!arrayMapping.IsAnonymousType)
1126 {
1127 _types.Add(arrayMapping.TypeName, arrayMapping.Namespace, arrayMapping);
1128 }
1129 else
1130 {
1132 }
1133 return arrayMapping;
1134 }
1135
1137 {
1138 switch (context)
1139 {
1140 case ImportContext.Element:
1141 if (typeDesc.CanBeElementValue)
1142 {
1143 return;
1144 }
1145 break;
1146 case ImportContext.Attribute:
1147 if (typeDesc.CanBeAttributeValue)
1148 {
1149 return;
1150 }
1151 break;
1152 case ImportContext.Text:
1153 if (typeDesc.CanBeTextValue || typeDesc.IsEnum || typeDesc.IsPrimitive)
1154 {
1155 return;
1156 }
1157 break;
1158 default:
1159 throw new ArgumentException(System.SR.XmlInternalError, "context");
1160 }
1161 throw UnsupportedException(typeDesc, context);
1162 }
1163
1165 {
1167 if (dataType.Length > 0)
1168 {
1169 primitiveMapping.TypeDesc = _typeScope.GetTypeDesc(dataType, "http://www.w3.org/2001/XMLSchema");
1170 if (primitiveMapping.TypeDesc == null)
1171 {
1172 primitiveMapping.TypeDesc = _typeScope.GetTypeDesc(dataType, "http://microsoft.com/wsdl/types/");
1173 if (primitiveMapping.TypeDesc == null)
1174 {
1176 }
1177 }
1178 }
1179 else
1180 {
1182 }
1183 primitiveMapping.TypeName = primitiveMapping.TypeDesc.DataType.Name;
1184 primitiveMapping.Namespace = (primitiveMapping.TypeDesc.IsXsdType ? "http://www.w3.org/2001/XMLSchema" : "http://microsoft.com/wsdl/types/");
1186 CheckContext(primitiveMapping.TypeDesc, context);
1187 return primitiveMapping;
1188 }
1189
1190 [RequiresUnreferencedCode("calls XsdTypeName")]
1192 {
1193 XmlAttributes attributes = GetAttributes(model.Type, canBeSimpleType: false);
1194 string text = ns;
1195 if (attributes.XmlType != null && attributes.XmlType.Namespace != null)
1196 {
1197 text = attributes.XmlType.Namespace;
1198 }
1199 string name = (IsAnonymousType(attributes, ns) ? null : XsdTypeName(model.Type, attributes, model.TypeDesc.Name));
1200 name = XmlConvert.EncodeLocalName(name);
1202 if (enumMapping == null)
1203 {
1204 enumMapping = new EnumMapping();
1205 enumMapping.TypeDesc = model.TypeDesc;
1206 enumMapping.TypeName = name;
1208 enumMapping.IsFlags = model.Type.IsDefined(typeof(FlagsAttribute), inherit: false);
1209 if (enumMapping.IsFlags && repeats)
1210 {
1212 }
1215 if (!enumMapping.IsAnonymousType)
1216 {
1217 _types.Add(name, text, enumMapping);
1218 }
1219 else
1220 {
1222 }
1224 for (int i = 0; i < model.Constants.Length; i++)
1225 {
1227 if (constantMapping != null)
1228 {
1229 list.Add(constantMapping);
1230 }
1231 }
1232 if (list.Count == 0)
1233 {
1235 }
1236 enumMapping.Constants = list.ToArray();
1238 }
1239 return enumMapping;
1240 }
1241
1243 {
1244 XmlAttributes attributes = GetAttributes(model.FieldInfo);
1245 if (attributes.XmlIgnore)
1246 {
1247 return null;
1248 }
1249 if (((uint)attributes.XmlFlags & 0xFFFFFFFEu) != 0)
1250 {
1252 }
1253 if (attributes.XmlEnum == null)
1254 {
1256 }
1258 constantMapping.XmlName = ((attributes.XmlEnum.Name == null) ? model.Name : attributes.XmlEnum.Name);
1261 return constantMapping;
1262 }
1263
1264 [RequiresUnreferencedCode("calls GetTypeDesc")]
1266 {
1270 NameTable elements = new NameTable();
1271 NameTable attributes = new NameTable();
1273 bool flag = false;
1274 for (int i = 0; i < array.Length; i++)
1275 {
1276 try
1277 {
1279 if (!hasWrapperElement && memberMapping.Attribute != null)
1280 {
1281 if (rpc)
1282 {
1284 }
1286 }
1287 if (rpc && xmlReflectionMembers[i].IsReturnValue)
1288 {
1289 if (i > 0)
1290 {
1292 }
1294 }
1295 array[i] = memberMapping;
1296 flag |= memberMapping.IsSequence;
1298 {
1299 AddUniqueAccessor(memberMapping, elements, attributes, flag);
1300 }
1301 array[i] = memberMapping;
1302 if (memberMapping.Text != null)
1303 {
1304 if (textAccessor != null)
1305 {
1307 }
1309 }
1310 if (memberMapping.Xmlns != null)
1311 {
1312 if (membersMapping.XmlnsMember != null)
1313 {
1315 }
1317 }
1318 }
1319 catch (Exception ex)
1320 {
1322 {
1323 throw;
1324 }
1326 }
1327 }
1328 if (flag)
1329 {
1331 }
1334 return membersMapping;
1335 }
1336
1337 [RequiresUnreferencedCode("Calls TypeScope.GetTypeDesc(Type) and XmlReflectionImporter.ImportAccessorMapping both of which RequireUnreferencedCode")]
1339 {
1340 XmlSchemaForm form = ((!rpc) ? XmlSchemaForm.Qualified : XmlSchemaForm.Unqualified);
1343 if (xmlAttributes.XmlFlags == (XmlAttributeFlags)0)
1344 {
1345 if (typeDesc.IsArrayLike)
1346 {
1352 }
1353 else
1354 {
1356 if (typeDesc.IsStructLike)
1357 {
1359 if (xmlAttributes2.XmlRoot != null)
1360 {
1361 if (xmlAttributes2.XmlRoot.ElementName.Length > 0)
1362 {
1363 xmlElementAttribute.ElementName = xmlAttributes2.XmlRoot.ElementName;
1364 }
1365 if (rpc)
1366 {
1368 if (xmlAttributes2.XmlRoot.GetIsNullableSpecified())
1369 {
1371 }
1372 }
1373 else
1374 {
1377 }
1378 }
1379 }
1380 if (xmlElementAttribute.ElementName.Length == 0)
1381 {
1383 }
1384 if (xmlElementAttribute.Namespace == null && !rpc)
1385 {
1387 }
1390 }
1391 }
1392 else if (xmlAttributes.XmlRoot != null)
1393 {
1394 CheckNullable(xmlAttributes.XmlRoot.IsNullable, typeDesc, null);
1395 }
1400 memberMapping.CheckShouldPersist = fieldModel.CheckShouldPersist;
1404 if (xmlAttributes.XmlChoiceIdentifier != null)
1405 {
1407 }
1409 if (xmlReflectionMember.OverrideIsNullable && memberMapping.Elements.Length != 0)
1410 {
1411 memberMapping.Elements[0].IsNullable = false;
1412 }
1413 return memberMapping;
1414 }
1415
1417 {
1418 for (int i = 0; i < reflectionMembers.Length; i++)
1419 {
1420 if (string.Equals(reflectionMembers[i].MemberName, memberName + "Specified", StringComparison.Ordinal))
1421 {
1422 return reflectionMembers[i];
1423 }
1424 }
1425 return null;
1426 }
1427
1428 [RequiresUnreferencedCode("calls ImportAccessorMapping")]
1430 {
1433 memberMapping.CheckShouldPersist = model.CheckShouldPersist;
1434 memberMapping.CheckSpecified = model.CheckSpecified;
1435 memberMapping.MemberInfo = model.MemberInfo;
1436 memberMapping.CheckSpecifiedMemberInfo = model.CheckSpecifiedMemberInfo;
1437 memberMapping.CheckShouldPersistMethodInfo = model.CheckShouldPersistMethodInfo;
1438 memberMapping.ReadOnly = model.ReadOnly;
1440 if (a.XmlChoiceIdentifier != null)
1441 {
1442 choiceIdentifierType = GetChoiceIdentifierType(a.XmlChoiceIdentifier, parent, model.FieldTypeDesc.IsArrayLike, model.Name);
1443 }
1445 return memberMapping;
1446 }
1447
1449 {
1450 if (type.IsArray)
1451 {
1452 if (!isArrayLike)
1453 {
1455 }
1456 type = type.GetElementType();
1457 }
1458 else if (isArrayLike)
1459 {
1461 }
1462 if (!type.IsEnum)
1463 {
1465 }
1466 return type;
1467 }
1468
1470 {
1471 for (int i = 0; i < xmlReflectionMembers.Length; i++)
1472 {
1473 if (choice.MemberName == xmlReflectionMembers[i].MemberName)
1474 {
1476 }
1477 }
1479 }
1480
1481 [RequiresUnreferencedCode("calls GetFieldModel")]
1483 {
1484 MemberInfo[] array = structModel.Type.GetMember(choice.MemberName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
1485 if (array == null || array.Length == 0)
1486 {
1487 PropertyInfo property = structModel.Type.GetProperty(choice.MemberName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
1488 if (property == null)
1489 {
1491 }
1492 array = new MemberInfo[1] { property };
1493 }
1494 else if (array.Length > 1)
1495 {
1497 }
1498 FieldModel fieldModel = structModel.GetFieldModel(array[0]);
1499 if (fieldModel == null)
1500 {
1502 }
1503 choice.SetMemberInfo(fieldModel.MemberInfo);
1504 Type fieldType = fieldModel.FieldType;
1506 }
1507
1508 [RequiresUnreferencedCode("calls ImportTypeMapping")]
1510 {
1512 int num = 0;
1513 while (attributes != null && num < attributes.Count)
1514 {
1516 if (xmlArrayItemAttribute.NestingLevel == _arrayNestingLevel)
1517 {
1529 }
1530 num++;
1531 }
1533 }
1534
1535 [RequiresUnreferencedCode("calls GetArrayElementType")]
1537 {
1540 int num = -1;
1545 _savedArrayNamespace = null;
1546 Type fieldType = model.FieldType;
1547 string name = model.Name;
1551 XmlAttributeFlags xmlFlags = a.XmlFlags;
1552 accessor.Ignore = a.XmlIgnore;
1553 if (rpc)
1554 {
1556 }
1557 else
1558 {
1560 }
1564 if ((xmlFlags & xmlAttributeFlags3) != 0 && fieldType == typeof(byte[]))
1565 {
1567 }
1568 if (a.XmlChoiceIdentifier != null)
1569 {
1571 accessor.ChoiceIdentifier.MemberName = a.XmlChoiceIdentifier.MemberName;
1572 accessor.ChoiceIdentifier.MemberInfo = a.XmlChoiceIdentifier.GetMemberInfo();
1574 CheckChoiceIdentifierMapping((EnumMapping)accessor.ChoiceIdentifier.Mapping);
1575 }
1576 if (accessor.TypeDesc.IsArrayLike)
1577 {
1578 Type arrayElementType = TypeScope.GetArrayElementType(fieldType, model.FieldTypeDesc.FullName + "." + model.Name);
1579 if ((xmlFlags & xmlAttributeFlags2) != 0)
1580 {
1582 {
1584 }
1585 if (a.XmlAttribute != null && !accessor.TypeDesc.ArrayElementTypeDesc.IsPrimitive && !accessor.TypeDesc.ArrayElementTypeDesc.IsEnum)
1586 {
1587 if (accessor.TypeDesc.ArrayElementTypeDesc.Kind == TypeKind.Serializable)
1588 {
1589 throw new InvalidOperationException(System.SR.Format(System.SR.XmlIllegalAttrOrTextInterface, name, accessor.TypeDesc.ArrayElementTypeDesc.FullName, "IXmlSerializable"));
1590 }
1591 throw new InvalidOperationException(System.SR.Format(System.SR.XmlIllegalAttrOrText, name, accessor.TypeDesc.ArrayElementTypeDesc.FullName));
1592 }
1593 bool flag = a.XmlAttribute != null && (accessor.TypeDesc.ArrayElementTypeDesc.IsPrimitive || accessor.TypeDesc.ArrayElementTypeDesc.IsEnum);
1594 if (a.XmlAnyAttribute != null)
1595 {
1597 }
1599 Type type = ((a.XmlAttribute.Type == null) ? arrayElementType : a.XmlAttribute.Type);
1601 attributeAccessor.Name = Accessor.EscapeQName((a.XmlAttribute.AttributeName.Length == 0) ? name : a.XmlAttribute.AttributeName);
1602 attributeAccessor.Namespace = ((a.XmlAttribute.Namespace == null) ? ns : a.XmlAttribute.Namespace);
1603 attributeAccessor.Form = a.XmlAttribute.Form;
1604 if (attributeAccessor.Form == XmlSchemaForm.None && ns != attributeAccessor.Namespace)
1605 {
1607 }
1608 attributeAccessor.CheckSpecial();
1609 CheckForm(attributeAccessor.Form, ns != attributeAccessor.Namespace);
1610 attributeAccessor.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(type), ns, ImportContext.Attribute, a.XmlAttribute.DataType, null, flag, openModel: false, limiter);
1612 attributeAccessor.Default = GetDefaultValue(model.FieldTypeDesc, model.FieldType, a);
1614 if (attributeAccessor.Form == XmlSchemaForm.Qualified && attributeAccessor.Namespace != ns)
1615 {
1616 if (_xsdAttributes == null)
1617 {
1618 _xsdAttributes = new NameTable();
1619 }
1621 }
1623 }
1624 else if ((xmlFlags & xmlAttributeFlags) != 0)
1625 {
1627 {
1629 }
1630 if (a.XmlText != null)
1631 {
1633 Type type2 = ((a.XmlText.Type == null) ? arrayElementType : a.XmlText.Type);
1635 textAccessor.Name = name;
1636 textAccessor.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(type2), ns, ImportContext.Text, a.XmlText.DataType, null, repeats: true, openModel: false, limiter);
1637 if (!(textAccessor.Mapping is SpecialMapping) && typeDesc2 != _typeScope.GetTypeDesc(typeof(string)))
1638 {
1640 }
1642 }
1643 if (a.XmlText == null && a.XmlElements.Count == 0 && a.XmlAnyElements.Count == 0)
1644 {
1645 a.XmlElements.Add(CreateElementAttribute(accessor.TypeDesc));
1646 }
1647 for (int i = 0; i < a.XmlElements.Count; i++)
1648 {
1649 XmlElementAttribute xmlElementAttribute = a.XmlElements[i];
1656 if (a.XmlElements.Count == 1)
1657 {
1658 elementAccessor.Name = XmlConvert.EncodeLocalName((xmlElementAttribute.ElementName.Length == 0) ? name : xmlElementAttribute.ElementName);
1659 }
1660 else
1661 {
1663 }
1664 elementAccessor.Default = GetDefaultValue(model.FieldTypeDesc, model.FieldType, a);
1665 if (xmlElementAttribute.GetIsNullableSpecified() && !xmlElementAttribute.IsNullable && typeModel.TypeDesc.IsOptionalValue)
1666 {
1667 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidNotNullable, typeModel.TypeDesc.BaseTypeDesc.FullName, "XmlElement"));
1668 }
1669 elementAccessor.IsNullable = (xmlElementAttribute.GetIsNullableSpecified() ? xmlElementAttribute.IsNullable : typeModel.TypeDesc.IsOptionalValue);
1672 if (!rpc)
1673 {
1674 CheckForm(elementAccessor.Form, ns != elementAccessor.Namespace);
1676 }
1677 if (xmlElementAttribute.Order != -1)
1678 {
1679 if (xmlElementAttribute.Order != num && num != -1)
1680 {
1682 }
1683 num = xmlElementAttribute.Order;
1684 }
1687 }
1689 for (int j = 0; j < a.XmlAnyElements.Count; j++)
1690 {
1693 if (!arrayElementType.IsAssignableFrom(type4))
1694 {
1696 }
1698 string text = (xmlAnyElementAttribute.GetNamespaceSpecified() ? xmlAnyElementAttribute.Namespace : null);
1699 if (nameTable2[name2, text] != null)
1700 {
1701 continue;
1702 }
1704 if (nameTable[name2, (text == null) ? ns : text] != null)
1705 {
1707 }
1710 elementAccessor2.Namespace = ((text == null) ? ns : text);
1711 elementAccessor2.Any = true;
1715 if (elementAccessor2.Name.Length > 0)
1716 {
1718 }
1720 elementAccessor2.Default = GetDefaultValue(model.FieldTypeDesc, model.FieldType, a);
1724 if (!rpc)
1725 {
1726 CheckForm(elementAccessor2.Form, ns != elementAccessor2.Namespace);
1728 }
1731 if (xmlAnyElementAttribute.Order != -1)
1732 {
1733 if (xmlAnyElementAttribute.Order != num && num != -1)
1734 {
1736 }
1737 num = xmlAnyElementAttribute.Order;
1738 }
1739 }
1740 }
1741 else
1742 {
1744 {
1746 }
1748 if (a.XmlArray == null)
1749 {
1751 }
1752 if (CountAtLevel(a.XmlArrayItems, _arrayNestingLevel) == 0)
1753 {
1755 }
1757 elementAccessor3.Name = XmlConvert.EncodeLocalName((a.XmlArray.ElementName.Length == 0) ? name : a.XmlArray.ElementName);
1758 elementAccessor3.Namespace = (rpc ? null : ((a.XmlArray.Namespace == null) ? ns : a.XmlArray.Namespace));
1759 _savedArrayItemAttributes = a.XmlArrayItems;
1763 elementAccessor3.IsNullable = a.XmlArray.IsNullable;
1765 num = a.XmlArray.Order;
1766 CheckNullable(elementAccessor3.IsNullable, accessor.TypeDesc, elementAccessor3.Mapping);
1767 if (!rpc)
1768 {
1769 CheckForm(elementAccessor3.Form, ns != elementAccessor3.Namespace);
1771 }
1773 _savedArrayNamespace = null;
1776 }
1777 }
1778 else if (!accessor.TypeDesc.IsVoid)
1779 {
1782 {
1784 }
1785 if (accessor.TypeDesc.IsPrimitive || accessor.TypeDesc.IsEnum)
1786 {
1787 if (a.XmlAnyElements.Count > 0)
1788 {
1790 }
1791 if (a.XmlAttribute != null)
1792 {
1793 if (a.XmlElements.Count > 0)
1794 {
1796 }
1797 if (a.XmlAttribute.Type != null)
1798 {
1799 throw new InvalidOperationException(System.SR.Format(System.SR.XmlIllegalType, "XmlAttribute"));
1800 }
1802 attributeAccessor2.Name = Accessor.EscapeQName((a.XmlAttribute.AttributeName.Length == 0) ? name : a.XmlAttribute.AttributeName);
1803 attributeAccessor2.Namespace = ((a.XmlAttribute.Namespace == null) ? ns : a.XmlAttribute.Namespace);
1804 attributeAccessor2.Form = a.XmlAttribute.Form;
1805 if (attributeAccessor2.Form == XmlSchemaForm.None && ns != attributeAccessor2.Namespace)
1806 {
1808 }
1809 attributeAccessor2.CheckSpecial();
1810 CheckForm(attributeAccessor2.Form, ns != attributeAccessor2.Namespace);
1812 attributeAccessor2.Default = GetDefaultValue(model.FieldTypeDesc, model.FieldType, a);
1814 if (attributeAccessor2.Form == XmlSchemaForm.Qualified && attributeAccessor2.Namespace != ns)
1815 {
1816 if (_xsdAttributes == null)
1817 {
1818 _xsdAttributes = new NameTable();
1819 }
1821 }
1823 }
1824 else
1825 {
1826 if (a.XmlText != null)
1827 {
1828 if (a.XmlText.Type != null && a.XmlText.Type != fieldType)
1829 {
1831 }
1833 textAccessor2.Name = name;
1836 }
1837 else if (a.XmlElements.Count == 0)
1838 {
1839 a.XmlElements.Add(CreateElementAttribute(accessor.TypeDesc));
1840 }
1841 for (int k = 0; k < a.XmlElements.Count; k++)
1842 {
1844 if (xmlElementAttribute2.Type != null && _typeScope.GetTypeDesc(xmlElementAttribute2.Type) != accessor.TypeDesc)
1845 {
1847 }
1849 elementAccessor4.Name = XmlConvert.EncodeLocalName((xmlElementAttribute2.ElementName.Length == 0) ? name : xmlElementAttribute2.ElementName);
1853 if (elementAccessor4.Mapping.TypeDesc.Kind == TypeKind.Node)
1854 {
1855 elementAccessor4.Any = true;
1856 }
1857 elementAccessor4.Default = GetDefaultValue(model.FieldTypeDesc, model.FieldType, a);
1858 if (xmlElementAttribute2.GetIsNullableSpecified() && !xmlElementAttribute2.IsNullable && typeModel3.TypeDesc.IsOptionalValue)
1859 {
1860 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidNotNullable, typeModel3.TypeDesc.BaseTypeDesc.FullName, "XmlElement"));
1861 }
1862 elementAccessor4.IsNullable = (xmlElementAttribute2.GetIsNullableSpecified() ? xmlElementAttribute2.IsNullable : typeModel3.TypeDesc.IsOptionalValue);
1864 CheckNullable(elementAccessor4.IsNullable, accessor.TypeDesc, elementAccessor4.Mapping);
1865 if (!rpc)
1866 {
1867 CheckForm(elementAccessor4.Form, ns != elementAccessor4.Namespace);
1869 }
1870 if (xmlElementAttribute2.Order != -1)
1871 {
1872 if (xmlElementAttribute2.Order != num && num != -1)
1873 {
1875 }
1876 num = xmlElementAttribute2.Order;
1877 }
1880 }
1881 }
1882 }
1883 else if (a.Xmlns)
1884 {
1885 if (xmlFlags != XmlAttributeFlags.XmlnsDeclarations)
1886 {
1888 }
1890 {
1892 }
1894 accessor.Ignore = true;
1895 }
1896 else
1897 {
1898 if (a.XmlAttribute != null || a.XmlText != null)
1899 {
1900 if (accessor.TypeDesc.Kind == TypeKind.Serializable)
1901 {
1902 throw new InvalidOperationException(System.SR.Format(System.SR.XmlIllegalAttrOrTextInterface, name, accessor.TypeDesc.FullName, "IXmlSerializable"));
1903 }
1905 }
1906 if (a.XmlElements.Count == 0 && a.XmlAnyElements.Count == 0)
1907 {
1908 a.XmlElements.Add(CreateElementAttribute(accessor.TypeDesc));
1909 }
1910 for (int l = 0; l < a.XmlElements.Count; l++)
1911 {
1919 if (a.XmlElements.Count == 1)
1920 {
1921 elementAccessor5.Name = XmlConvert.EncodeLocalName((xmlElementAttribute3.ElementName.Length == 0) ? name : xmlElementAttribute3.ElementName);
1922 }
1923 else
1924 {
1926 }
1927 elementAccessor5.Default = GetDefaultValue(model.FieldTypeDesc, model.FieldType, a);
1928 if (xmlElementAttribute3.GetIsNullableSpecified() && !xmlElementAttribute3.IsNullable && typeModel4.TypeDesc.IsOptionalValue)
1929 {
1930 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidNotNullable, typeModel4.TypeDesc.BaseTypeDesc.FullName, "XmlElement"));
1931 }
1932 elementAccessor5.IsNullable = (xmlElementAttribute3.GetIsNullableSpecified() ? xmlElementAttribute3.IsNullable : typeModel4.TypeDesc.IsOptionalValue);
1935 if (!rpc)
1936 {
1937 CheckForm(elementAccessor5.Form, ns != elementAccessor5.Namespace);
1939 }
1940 if (xmlElementAttribute3.Order != -1)
1941 {
1942 if (xmlElementAttribute3.Order != num && num != -1)
1943 {
1945 }
1946 num = xmlElementAttribute3.Order;
1947 }
1950 }
1952 for (int m = 0; m < a.XmlAnyElements.Count; m++)
1953 {
1955 Type type6 = (typeof(IXmlSerializable).IsAssignableFrom(fieldType) ? fieldType : (typeof(XmlNode).IsAssignableFrom(fieldType) ? fieldType : typeof(XmlElement)));
1956 if (!fieldType.IsAssignableFrom(type6))
1957 {
1959 }
1961 string text2 = (xmlAnyElementAttribute2.GetNamespaceSpecified() ? xmlAnyElementAttribute2.Namespace : null);
1962 if (nameTable3[name3, text2] != null)
1963 {
1964 continue;
1965 }
1967 if (nameTable[name3, (text2 == null) ? ns : text2] != null)
1968 {
1970 }
1973 elementAccessor6.Namespace = ((text2 == null) ? ns : text2);
1974 elementAccessor6.Any = true;
1978 if (elementAccessor6.Name.Length > 0)
1979 {
1981 }
1983 elementAccessor6.Default = GetDefaultValue(model.FieldTypeDesc, model.FieldType, a);
1987 if (!rpc)
1988 {
1989 CheckForm(elementAccessor6.Form, ns != elementAccessor6.Namespace);
1991 }
1992 if (xmlAnyElementAttribute2.Order != -1)
1993 {
1994 if (xmlAnyElementAttribute2.Order != num && num != -1)
1995 {
1997 }
1998 num = xmlAnyElementAttribute2.Order;
1999 }
2002 }
2003 }
2004 }
2006 accessor.SequenceId = num;
2007 if (rpc)
2008 {
2009 if (accessor.TypeDesc.IsArrayLike && accessor.Elements.Length != 0 && !(accessor.Elements[0].Mapping is ArrayMapping))
2010 {
2012 }
2013 if (accessor.Xmlns != null)
2014 {
2016 }
2017 }
2018 if (accessor.ChoiceIdentifier != null)
2019 {
2020 accessor.ChoiceIdentifier.MemberIds = new string[accessor.Elements.Length];
2021 for (int n = 0; n < accessor.Elements.Length; n++)
2022 {
2023 bool flag2 = false;
2025 EnumMapping enumMapping = (EnumMapping)accessor.ChoiceIdentifier.Mapping;
2026 for (int num2 = 0; num2 < enumMapping.Constants.Length; num2++)
2027 {
2028 string xmlName = enumMapping.Constants[num2].XmlName;
2029 if (elementAccessor7.Any && elementAccessor7.Name.Length == 0)
2030 {
2031 string text3 = ((elementAccessor7.AnyNamespaces == null) ? "##any" : elementAccessor7.AnyNamespaces);
2032 if (xmlName.Substring(0, xmlName.Length - 1) == text3)
2033 {
2034 accessor.ChoiceIdentifier.MemberIds[n] = enumMapping.Constants[num2].Name;
2035 flag2 = true;
2036 break;
2037 }
2038 continue;
2039 }
2040 int num3 = xmlName.LastIndexOf(':');
2041 string text4 = ((num3 < 0) ? enumMapping.Namespace : xmlName.Substring(0, num3));
2042 string text5 = ((num3 < 0) ? xmlName : xmlName.Substring(num3 + 1));
2043 if (elementAccessor7.Name == text5 && ((elementAccessor7.Form == XmlSchemaForm.Unqualified && string.IsNullOrEmpty(text4)) || elementAccessor7.Namespace == text4))
2044 {
2045 accessor.ChoiceIdentifier.MemberIds[n] = enumMapping.Constants[num2].Name;
2046 flag2 = true;
2047 break;
2048 }
2049 }
2050 if (!flag2)
2051 {
2052 if (elementAccessor7.Any && elementAccessor7.Name.Length == 0)
2053 {
2054 throw new InvalidOperationException(System.SR.Format(System.SR.XmlChoiceMissingAnyValue, accessor.ChoiceIdentifier.Mapping.TypeDesc.FullName));
2055 }
2057 throw new InvalidOperationException(System.SR.Format(System.SR.XmlChoiceMissingValue, accessor.ChoiceIdentifier.Mapping.TypeDesc.FullName, text6, elementAccessor7.Name, elementAccessor7.Namespace));
2058 }
2059 }
2060 }
2064 }
2065
2067 {
2068 XmlAttributeFlags xmlFlags = a.XmlFlags;
2069 if ((xmlFlags & (XmlAttributeFlags)544) != 0)
2070 {
2072 }
2073 if ((xmlFlags & (XmlAttributeFlags)1284) != 0)
2074 {
2076 }
2077 if (a.XmlElements != null && a.XmlElements.Count > 0)
2078 {
2079 if (a.XmlElements.Count > 1)
2080 {
2082 }
2083 XmlElementAttribute xmlElementAttribute = a.XmlElements[0];
2084 if (xmlElementAttribute.Namespace != null)
2085 {
2087 }
2088 if (xmlElementAttribute.IsNullable)
2089 {
2091 }
2092 }
2093 if (a.XmlArray != null && a.XmlArray.Namespace != null)
2094 {
2095 throw new InvalidOperationException(System.SR.Format(System.SR.XmlRpcLitElementNamespace, "Namespace", a.XmlArray.Namespace));
2096 }
2097 }
2098
2100 {
2101 Hashtable hashtable = new Hashtable();
2102 XmlElementAttributes xmlElements = a.XmlElements;
2103 if (xmlElements != null && xmlElements.Count >= 2 && a.XmlChoiceIdentifier == null)
2104 {
2105 for (int i = 0; i < xmlElements.Count; i++)
2106 {
2107 Type key = ((xmlElements[i].Type == null) ? accessorType : xmlElements[i].Type);
2108 if (hashtable.Contains(key))
2109 {
2110 throw new InvalidOperationException(System.SR.Format(System.SR.XmlChoiceIdentiferMissing, "XmlChoiceIdentifierAttribute", accessorName));
2111 }
2112 hashtable.Add(key, false);
2113 }
2114 }
2115 if (hashtable.Contains(typeof(XmlElement)) && a.XmlAnyElements.Count > 0)
2116 {
2117 throw new InvalidOperationException(System.SR.Format(System.SR.XmlChoiceIdentiferMissing, "XmlChoiceIdentifierAttribute", accessorName));
2118 }
2119 XmlArrayItemAttributes xmlArrayItems = a.XmlArrayItems;
2120 if (xmlArrayItems == null || xmlArrayItems.Count < 2)
2121 {
2122 return;
2123 }
2125 for (int j = 0; j < xmlArrayItems.Count; j++)
2126 {
2127 Type type = ((xmlArrayItems[j].Type == null) ? accessorType : xmlArrayItems[j].Type);
2128 string ns = xmlArrayItems[j].NestingLevel.ToString(CultureInfo.InvariantCulture);
2130 if (xmlArrayItemAttribute != null)
2131 {
2132 throw new InvalidOperationException(System.SR.Format(System.SR.XmlArrayItemAmbiguousTypes, accessorName, xmlArrayItemAttribute.ElementName, xmlArrayItems[j].ElementName, "XmlElementAttribute", "XmlChoiceIdentifierAttribute", accessorName));
2133 }
2134 nameTable[type.FullName, ns] = xmlArrayItems[j];
2135 }
2136 }
2137
2139 {
2141 for (int i = 0; i < choiceMapping.Constants.Length; i++)
2142 {
2143 string xmlName = choiceMapping.Constants[i].XmlName;
2144 int num = xmlName.LastIndexOf(':');
2145 string name = ((num < 0) ? xmlName : xmlName.Substring(num + 1));
2146 string ns = ((num < 0) ? "" : xmlName.Substring(0, num));
2147 if (nameTable[name, ns] != null)
2148 {
2150 }
2151 nameTable.Add(name, ns, choiceMapping.Constants[i]);
2152 }
2153 }
2154
2156 {
2157 if (a.XmlDefaultValue == null || a.XmlDefaultValue == DBNull.Value)
2158 {
2159 return null;
2160 }
2161 if (fieldTypeDesc.Kind != TypeKind.Primitive && fieldTypeDesc.Kind != TypeKind.Enum)
2162 {
2163 a.XmlDefaultValue = null;
2164 return a.XmlDefaultValue;
2165 }
2166 if (fieldTypeDesc.Kind == TypeKind.Enum)
2167 {
2168 string text = Enum.Format(t, a.XmlDefaultValue, "G").Replace(",", " ");
2169 string text2 = Enum.Format(t, a.XmlDefaultValue, "D");
2170 if (text == text2)
2171 {
2172 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidDefaultValue, text, a.XmlDefaultValue.GetType().FullName));
2173 }
2174 return text;
2175 }
2176 return a.XmlDefaultValue;
2177 }
2178
2185
2187 {
2188 return new XmlArrayAttribute();
2189 }
2190
2197
2198 private static void AddUniqueAccessor(INameScope scope, Accessor accessor)
2199 {
2200 Accessor accessor2 = (Accessor)scope[accessor.Name, accessor.Namespace];
2201 if (accessor2 != null)
2202 {
2204 {
2206 }
2208 }
2209 scope[accessor.Name, accessor.Namespace] = accessor;
2210 }
2211
2212 private static void AddUniqueAccessor(MemberMapping member, INameScope elements, INameScope attributes, bool isSequence)
2213 {
2214 if (member.Attribute != null)
2215 {
2216 AddUniqueAccessor(attributes, member.Attribute);
2217 }
2218 else if (!isSequence && member.Elements != null && member.Elements.Length != 0)
2219 {
2220 for (int i = 0; i < member.Elements.Length; i++)
2221 {
2222 AddUniqueAccessor(elements, member.Elements[i]);
2223 }
2224 }
2225 }
2226
2227 private static void CheckForm(XmlSchemaForm form, bool isQualified)
2228 {
2229 if (isQualified && form == XmlSchemaForm.Unqualified)
2230 {
2232 }
2233 }
2234
2236 {
2238 {
2239 return;
2240 }
2242 }
2243
2245 {
2247 bool flag = mapping.TypeDesc.Kind == TypeKind.Node;
2248 if (!flag && mapping is SerializableMapping)
2249 {
2250 flag = ((SerializableMapping)mapping).IsAny;
2251 }
2252 if (flag)
2253 {
2254 elementAccessor.Any = true;
2255 }
2256 else
2257 {
2258 elementAccessor.Name = mapping.DefaultElementName;
2260 }
2262 return elementAccessor;
2263 }
2264
2265 [RequiresUnreferencedCode("Calls TypeScope.GetTypeDesc(Type) which has RequiresUnreferencedCode")]
2266 internal static XmlTypeMapping GetTopLevelMapping(Type type, string defaultNamespace)
2267 {
2268 defaultNamespace = defaultNamespace ?? string.Empty;
2272 if (typeDesc.Kind == TypeKind.Node)
2273 {
2274 elementAccessor.Any = true;
2275 }
2276 else
2277 {
2278 string @namespace = ((xmlAttributes.XmlRoot == null) ? defaultNamespace : xmlAttributes.XmlRoot.Namespace);
2279 string text = string.Empty;
2280 if (xmlAttributes.XmlType != null)
2281 {
2282 text = xmlAttributes.XmlType.TypeName;
2283 }
2284 if (text.Length == 0)
2285 {
2286 text = type.Name;
2287 }
2289 elementAccessor.Namespace = @namespace;
2290 }
2292 xmlTypeMapping.SetKeyInternal(XmlMapping.GenerateKey(type, xmlAttributes.XmlRoot, defaultNamespace));
2293 return xmlTypeMapping;
2294 }
2295}
static bool IsValidLanguageIndependentIdentifier(string value)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
virtual bool Contains(object key)
Definition Hashtable.cs:719
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
static ? string ToString(object? value)
Definition Convert.cs:2321
static readonly DBNull Value
Definition DBNull.cs:8
static string Format(Type enumType, object value, string format)
Definition Enum.cs:896
static CultureInfo InvariantCulture
static string XmlRpcLitArrayElement
Definition SR.cs:1734
static string XmlTypeReflectionError
Definition SR.cs:1436
static string XmlIllegalType
Definition SR.cs:1462
static string XmlChoiceIdentifierTypeEnum
Definition SR.cs:1646
static string XmlSequenceUnique
Definition SR.cs:1798
static string XmlInvalidConstantAttribute
Definition SR.cs:1452
static string XmlInvalidAttributeUse
Definition SR.cs:1574
static string XmlRpcLitElementNullable
Definition SR.cs:1730
static string XmlFieldReflectionError
Definition SR.cs:1440
static string XmlInvalidNotNullable
Definition SR.cs:1476
static string XmlMethodTypeNameConflict
Definition SR.cs:1564
static string XmlDuplicateAttributeName
Definition SR.cs:1634
static string XmlAnyElementDuplicate
Definition SR.cs:1700
static string XmlIllegalAttrOrText
Definition SR.cs:1464
static string XmlInvalidIsNullable
Definition SR.cs:1474
static string XmlIllegalMultipleTextMembers
Definition SR.cs:1672
static string XmlMultipleXmlns
Definition SR.cs:1688
static string XmlRpcLitXmlns
Definition SR.cs:1742
static string XmlCannotReconcileAccessorDefault
Definition SR.cs:1570
static string XmlPropertyReflectionError
Definition SR.cs:1438
static string XmlChoiceIdentiferAmbiguous
Definition SR.cs:1650
static string XmlInternalError
Definition SR.cs:1812
static string XmlChoiceIdentifierArrayType
Definition SR.cs:1644
static string XmlInvalidTypeAttributes
Definition SR.cs:1572
static string XmlIllegalAttributeFlagsArray
Definition SR.cs:1470
static string XmlChoiceMissingAnyValue
Definition SR.cs:1656
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlXmlnsInvalidType
Definition SR.cs:1692
static string XmlArrayItemAmbiguousTypes
Definition SR.cs:1660
static string XmlIllegalArrayTextAttribute
Definition SR.cs:1674
static string XmlSoleXmlnsAttribute
Definition SR.cs:1694
static string XmlGetSchemaMethodMissing
Definition SR.cs:1754
static string XmlNoSerializableMembers
Definition SR.cs:1620
static string XmlCannotReconcileAttributeAccessor
Definition SR.cs:1568
static string XmlIllegalArrayArrayAttribute
Definition SR.cs:1458
static string XmlIllegalAttributesArrayAttribute
Definition SR.cs:1454
static string XmlIllegalAnyElement
Definition SR.cs:1472
static string XmlIllegalElementsArrayAttribute
Definition SR.cs:1456
static string XmlInvalidReturnPosition
Definition SR.cs:1594
static string XmlIllegalAttribute
Definition SR.cs:1460
static string XmlChoiceIdentiferMissing
Definition SR.cs:1652
static string XmlInvalidXsdDataType
Definition SR.cs:1444
static string XmlIllegalTypedTextAttribute
Definition SR.cs:1676
static string XmlInvalidDefaultValue
Definition SR.cs:1520
static string XmlSequenceInconsistent
Definition SR.cs:1796
static string XmlGetSchemaInclude
Definition SR.cs:1762
static string XmlChoiceIdentiferMemberMissing
Definition SR.cs:1648
static string XmlChoiceIdDuplicate
Definition SR.cs:1702
static string XmlIllegalTypeContext
Definition SR.cs:1448
static string XmlIllegalMultipleText
Definition SR.cs:1670
static string XmlSerializableAttributes
Definition SR.cs:1764
static string XmlRpcLitAttributes
Definition SR.cs:1738
static string XmlChoiceIdentifierType
Definition SR.cs:1642
static string XmlDataTypeMismatch
Definition SR.cs:1446
static string XmlGetSchemaMethodName
Definition SR.cs:1752
static string XmlSequenceMembers
Definition SR.cs:1740
static string XmlRpcLitAttributeAttributes
Definition SR.cs:1736
static string XmlMultipleXmlnsMembers
Definition SR.cs:1690
static string XmlSequenceMatch
Definition SR.cs:1802
static string XmlReflectionError
Definition SR.cs:1434
static string XmlAnonymousInclude
Definition SR.cs:1746
static string XmlCannotReconcileAccessor
Definition SR.cs:1566
static string XmlInvalidAttributeType
Definition SR.cs:1602
static string XmlUnsupportedInheritance
Definition SR.cs:1668
static string XmlMissingSchema
Definition SR.cs:1618
static string XmlInvalidDataTypeUsage
Definition SR.cs:1442
static string XmlTypesDuplicate
Definition SR.cs:1576
static string XmlGetSchemaMethodReturnType
Definition SR.cs:1756
static string XmlUdeclaredXsdType
Definition SR.cs:1450
static string XmlIllegalAttrOrTextInterface
Definition SR.cs:1468
static string XmlDuplicateElementName
Definition SR.cs:1632
static string XmlInvalidFormUnqualified
Definition SR.cs:1478
static string XmlRpcLitElements
Definition SR.cs:1732
static string XmlChoiceMissingValue
Definition SR.cs:1654
static string XmlRpcLitElementNamespace
Definition SR.cs:1728
Definition SR.cs:7
static bool ElementsMatch(ElementAccessor[] a, ElementAccessor[] b)
static string EscapeQName(string name)
Definition Accessor.cs:172
static string MakePascal(string identifier)
TypeModel GetTypeModel(Type type)
Definition ModelScope.cs:22
ArrayModel GetArrayModel(Type type)
Definition ModelScope.cs:66
void Add(XmlQualifiedName qname, object value)
Definition NameTable.cs:57
static bool IsKnownType(Type type)
Definition TypeScope.cs:81
void AddTypeMapping(TypeMapping typeMapping)
Definition TypeScope.cs:930
TypeDesc GetArrayTypeDesc(Type type)
Definition TypeScope.cs:280
static bool IsOptionalValue(Type type)
Definition TypeScope.cs:537
static Type GetArrayElementType(Type type, string memberInfo)
Definition TypeScope.cs:576
TypeDesc GetTypeDesc(string name, string ns)
Definition TypeScope.cs:224
static string GenerateKey(Type type, XmlRootAttribute root, string ns)
Definition XmlMapping.cs:82
void CheckContext(TypeDesc typeDesc, ImportContext context)
object GetDefaultValue(TypeDesc fieldTypeDesc, Type t, XmlAttributes a)
void IncludeTypes(ICustomAttributeProvider provider, RecursionLimiter limiter)
MemberMapping ImportFieldMapping(StructModel parent, FieldModel model, XmlAttributes a, string ns, RecursionLimiter limiter)
TypeMapping ImportTypeMapping(TypeModel model, string ns, ImportContext context, string dataType, XmlAttributes a, RecursionLimiter limiter)
void IncludeType(Type type, RecursionLimiter limiter)
NullableMapping CreateNullableMapping(TypeMapping baseMapping, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
EnumMapping ImportEnumMapping(EnumModel model, string ns, bool repeats)
Exception CreateTypeReflectionException(string context, Exception e)
XmlMembersMapping ImportMembersMapping(string? elementName, string? ns, XmlReflectionMember[] members, bool hasWrapperElement, bool rpc, bool openModel)
static void CheckNullable(bool isNullable, TypeDesc typeDesc, TypeMapping mapping)
static MethodInfo GetMethodFromSchemaProvider(XmlSchemaProviderAttribute provider, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type)
void SetBase(SerializableMapping mapping, XmlQualifiedName baseQname)
TypeMapping ImportTypeMapping(TypeModel model, string ns, ImportContext context, string dataType, XmlAttributes a, bool repeats, bool openModel, RecursionLimiter limiter)
Type CheckChoiceIdentifierType(Type type, bool isArrayLike, string identifierName, string memberName)
TypeMapping GetTypeMapping(string typeName, string ns, TypeDesc typeDesc, NameTable typeLib, Type type)
static ElementAccessor CreateElementAccessor(TypeMapping mapping, string ns)
bool InitializeStructMembers(StructMapping mapping, StructModel model, bool openModel, string typeName, RecursionLimiter limiter)
Type GetChoiceIdentifierType(XmlChoiceIdentifierAttribute choice, StructModel structModel, bool isArrayLike, string accessorName)
XmlTypeMapping ImportTypeMapping(Type type, string? defaultNamespace)
string XsdTypeName(Type type, XmlAttributes a, string name)
void CreateArrayElementsFromAttributes(ArrayMapping arrayMapping, XmlArrayItemAttributes attributes, Type arrayElementType, string arrayElementNs, RecursionLimiter limiter)
static Exception UnsupportedException(TypeDesc typeDesc, ImportContext context)
PrimitiveMapping ImportPrimitiveMapping(PrimitiveModel model, ImportContext context, string dataType, bool repeats)
XmlReflectionImporter(XmlAttributeOverrides? attributeOverrides)
static XmlTypeMapping GetTopLevelMapping(Type type, string defaultNamespace)
static void AddUniqueAccessor(INameScope scope, Accessor accessor)
MembersMapping ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, string ns, bool hasWrapperElement, bool rpc, bool openModel, RecursionLimiter limiter)
MemberMapping ImportMemberMapping(XmlReflectionMember xmlReflectionMember, string ns, XmlReflectionMember[] xmlReflectionMembers, bool rpc, bool openModel, RecursionLimiter limiter)
XmlMembersMapping ImportMembersMapping(string? elementName, string? ns, XmlReflectionMember[] members, bool hasWrapperElement, bool rpc, bool openModel, XmlMappingAccess access)
void CheckAmbiguousChoice(XmlAttributes a, Type accessorType, string accessorName)
ElementAccessor ReconcileLocalAccessor(ElementAccessor accessor, string ns)
static void CheckForm(XmlSchemaForm form, bool isQualified)
XmlReflectionImporter(XmlAttributeOverrides? attributeOverrides, string? defaultNamespace)
static XmlReflectionMember FindSpecifiedMember(string memberName, XmlReflectionMember[] reflectionMembers)
void ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, string ns, Type choiceIdentifierType, bool rpc, bool openModel, RecursionLimiter limiter)
static XmlArrayItemAttribute CreateArrayItemAttribute(TypeDesc typeDesc, int nestingLevel)
XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute? root, string? defaultNamespace)
static XmlElementAttribute CreateElementAttribute(TypeDesc typeDesc)
void CheckChoiceIdentifierMapping(EnumMapping choiceMapping)
Type GetChoiceIdentifierType(XmlChoiceIdentifierAttribute choice, XmlReflectionMember[] xmlReflectionMembers, bool isArrayLike, string accessorName)
void SetArrayMappingType(ArrayMapping mapping, string defaultNs, Type type)
ConstantMapping ImportConstantMapping(ConstantModel model)
void CheckTopLevelAttributes(XmlAttributes a, string accessorName)
static int CountAtLevel(XmlArrayItemAttributes attributes, int level)
XmlMembersMapping ImportMembersMapping(string? elementName, string? ns, XmlReflectionMember[] members, bool hasWrapperElement)
static void AddUniqueAccessor(MemberMapping member, INameScope elements, INameScope attributes, bool isSequence)
Accessor ReconcileAccessor(Accessor accessor, NameTable accessors)
XmlAttributes GetAttributes(MemberInfo memberInfo)
void IncludeTypes(ICustomAttributeProvider provider)
SpecialMapping ImportSpecialMapping(Type type, TypeDesc typeDesc, string ns, ImportContext context, RecursionLimiter limiter)
ElementAccessor ImportElement(TypeModel model, XmlRootAttribute root, string defaultNamespace, RecursionLimiter limiter)
StructMapping ImportStructLikeMapping(StructModel model, string ns, bool openModel, XmlAttributes a, RecursionLimiter limiter)
static string GetContextName(ImportContext context)
XmlMembersMapping ImportMembersMapping(string? elementName, string? ns, XmlReflectionMember[] members, bool hasWrapperElement, bool rpc)
ArrayMapping ImportArrayLikeMapping(ArrayModel model, string ns, RecursionLimiter limiter)
static XmlArrayAttribute CreateArrayAttribute(TypeDesc typeDesc)
static bool IsAnonymousType(XmlAttributes a, string contextNs)
Exception CreateMemberReflectionException(FieldModel model, Exception e)
XmlAttributes GetAttributes(Type type, bool canBeSimpleType)
XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute? root)
Exception CreateReflectionException(string context, Exception e)
static ? string EncodeLocalName(string? name)
Definition XmlConvert.cs:49