Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ImportAnyMapping()

SpecialMapping System.Xml.Serialization.XmlSchemaImporter.ImportAnyMapping ( XmlSchemaType type,
string identifier,
string ns,
bool repeats )
inlineprivate

Definition at line 1382 of file XmlSchemaImporter.cs.

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);
1393 TypeItems typeItems = GetTypeItems(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 }
1412 SpecialMapping specialMapping = new SpecialMapping();
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 }
1431 RunSchemaExtensions(specialMapping, XmlQualifiedName.Empty, null, xmlSchemaAny, typeFlags);
1433 if (repeats)
1434 {
1435 specialMapping.TypeDesc = specialMapping.TypeDesc.CreateArrayTypeDesc();
1436 }
1437 return specialMapping;
1438 }
static bool IsMixed(XmlSchemaType type)
void RunSchemaExtensions(TypeMapping mapping, XmlQualifiedName qname, XmlSchemaType type, XmlSchemaObject context, TypeFlags flags)
TypeItems GetTypeItems(XmlSchemaType type)

References System.Collections.CollectionBase.Count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.XmlQualifiedName.Empty, System.Xml.Serialization.XmlSchemaImporter.GetTypeItems(), System.Xml.Serialization.XmlSchemaImporter.IsMixed(), System.Xml.Schema.XmlSchemaGroupBase.Items, System.Xml.Serialization.XmlSchemaImporter.RunSchemaExtensions(), and System.type.

Referenced by System.Xml.Serialization.XmlSchemaImporter.ImportType().