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

◆ Preprocess()

void System.Xml.Schema.Preprocessor.Preprocess ( XmlSchema schema,
string targetNamespace,
ArrayList imports )
inlineprivate

Definition at line 447 of file Preprocessor.cs.

448 {
449 XmlSchema xmlSchema = null;
450 if (schema.IsProcessing)
451 {
452 return;
453 }
454 schema.IsProcessing = true;
455 string targetNamespace2 = schema.TargetNamespace;
456 if (targetNamespace2 != null)
457 {
459 if (targetNamespace2.Length == 0)
460 {
462 }
463 else
464 {
466 }
467 }
468 if (schema.Version != null)
469 {
470 XmlSchemaDatatype datatype = DatatypeImplementation.GetSimpleTypeFromTypeCode(XmlTypeCode.Token).Datatype;
471 object typedValue;
472 Exception ex = datatype.TryParseValue(schema.Version, null, null, out typedValue);
473 if (ex != null)
474 {
475 SendValidationEvent(System.SR.Sch_AttributeValueDataTypeDetailed, new string[4] { "version", schema.Version, datatype.TypeCodeString, ex.Message }, ex, schema);
476 }
477 else
478 {
479 schema.Version = (string)typedValue;
480 }
481 }
483 for (int i = 0; i < schema.Includes.Count; i++)
484 {
485 XmlSchemaExternal xmlSchemaExternal = (XmlSchemaExternal)schema.Includes[i];
486 XmlSchema xmlSchema2 = xmlSchemaExternal.Schema;
489 string schemaLocation = xmlSchemaExternal.SchemaLocation;
490 if (schemaLocation != null)
491 {
493 }
494 else if ((xmlSchemaExternal.Compositor == Compositor.Include || xmlSchemaExternal.Compositor == Compositor.Redefine) && xmlSchema2 == null)
495 {
497 }
498 switch (xmlSchemaExternal.Compositor)
499 {
500 case Compositor.Import:
501 {
502 XmlSchemaImport xmlSchemaImport = xmlSchemaExternal as XmlSchemaImport;
503 string @namespace = xmlSchemaImport.Namespace;
504 if (@namespace == schema.TargetNamespace)
505 {
507 }
508 if (xmlSchema2 != null)
509 {
510 if (@namespace != xmlSchema2.TargetNamespace)
511 {
512 SendValidationEvent(System.SR.Sch_MismatchTargetNamespaceImport, @namespace, xmlSchema2.TargetNamespace, xmlSchemaImport);
513 }
514 xmlSchema = _rootSchemaForRedefine;
515 _rootSchemaForRedefine = xmlSchema2;
516 Preprocess(xmlSchema2, @namespace, imports);
517 _rootSchemaForRedefine = xmlSchema;
518 }
519 else if (@namespace != null)
520 {
521 if (@namespace.Length == 0)
522 {
523 SendValidationEvent(System.SR.Sch_InvalidNamespaceAttribute, @namespace, xmlSchemaExternal);
524 }
525 else
526 {
527 ParseUri(@namespace, System.SR.Sch_InvalidNamespace, xmlSchemaExternal);
528 }
529 }
530 continue;
531 }
532 case Compositor.Include:
533 {
534 XmlSchema schema2 = xmlSchemaExternal.Schema;
535 if (schema2 == null)
536 {
537 continue;
538 }
539 break;
540 }
541 case Compositor.Redefine:
542 if (xmlSchema2 == null)
543 {
544 continue;
545 }
547 break;
548 }
549 if (xmlSchema2.TargetNamespace != null)
550 {
551 if (schema.TargetNamespace != xmlSchema2.TargetNamespace)
552 {
554 }
555 }
556 else if (targetNamespace != null && targetNamespace.Length != 0)
557 {
559 }
560 Preprocess(xmlSchema2, schema.TargetNamespace, imports);
561 }
565 _targetNamespace = ((targetNamespace == null) ? string.Empty : targetNamespace);
568 for (int j = 0; j < schema.Includes.Count; j++)
569 {
570 XmlSchemaExternal xmlSchemaExternal2 = (XmlSchemaExternal)schema.Includes[j];
571 XmlSchema schema3 = xmlSchemaExternal2.Schema;
572 if (schema3 != null)
573 {
574 switch (xmlSchemaExternal2.Compositor)
575 {
576 case Compositor.Include:
577 if (_processedExternals[schema3] != null)
578 {
579 continue;
580 }
583 break;
584 case Compositor.Redefine:
585 if (_redefinedList == null)
586 {
588 }
589 _redefinedList.Add(new RedefineEntry(xmlSchemaExternal2 as XmlSchemaRedefine, _rootSchemaForRedefine));
590 if (_processedExternals[schema3] != null)
591 {
592 continue;
593 }
596 break;
597 case Compositor.Import:
598 if (schema3 != _rootSchema)
599 {
600 XmlSchemaImport xmlSchemaImport2 = xmlSchemaExternal2 as XmlSchemaImport;
601 string text2 = ((xmlSchemaImport2.Namespace != null) ? xmlSchemaImport2.Namespace : string.Empty);
603 {
605 }
607 {
609 }
610 }
611 break;
612 }
613 }
614 else if (xmlSchemaExternal2.Compositor == Compositor.Redefine)
615 {
616 XmlSchemaRedefine xmlSchemaRedefine = xmlSchemaExternal2 as XmlSchemaRedefine;
617 if (xmlSchemaRedefine.BaseUri == null)
618 {
619 for (int k = 0; k < xmlSchemaRedefine.Items.Count; k++)
620 {
621 if (!(xmlSchemaRedefine.Items[k] is XmlSchemaAnnotation))
622 {
624 break;
625 }
626 }
627 }
628 }
630 }
632 XmlSchemaObjectCollection items = schema.Items;
633 for (int l = 0; l < items.Count; l++)
634 {
635 SetParent(items[l], schema);
636 if (items[l] is XmlSchemaAttribute xmlSchemaAttribute)
637 {
639 AddToTable(schema.Attributes, xmlSchemaAttribute.QualifiedName, xmlSchemaAttribute);
640 }
641 else if (items[l] is XmlSchemaAttributeGroup xmlSchemaAttributeGroup)
642 {
644 AddToTable(schema.AttributeGroups, xmlSchemaAttributeGroup.QualifiedName, xmlSchemaAttributeGroup);
645 }
646 else if (items[l] is XmlSchemaComplexType xmlSchemaComplexType)
647 {
649 AddToTable(schema.SchemaTypes, xmlSchemaComplexType.QualifiedName, xmlSchemaComplexType);
650 }
651 else if (items[l] is XmlSchemaSimpleType xmlSchemaSimpleType)
652 {
654 AddToTable(schema.SchemaTypes, xmlSchemaSimpleType.QualifiedName, xmlSchemaSimpleType);
655 }
656 else if (items[l] is XmlSchemaElement xmlSchemaElement)
657 {
659 AddToTable(schema.Elements, xmlSchemaElement.QualifiedName, xmlSchemaElement);
660 }
661 else if (items[l] is XmlSchemaGroup xmlSchemaGroup)
662 {
664 AddToTable(schema.Groups, xmlSchemaGroup.QualifiedName, xmlSchemaGroup);
665 }
666 else if (items[l] is XmlSchemaNotation xmlSchemaNotation)
667 {
669 AddToTable(schema.Notations, xmlSchemaNotation.QualifiedName, xmlSchemaNotation);
670 }
671 else if (items[l] is XmlSchemaAnnotation annotation)
672 {
673 PreprocessAnnotation(annotation);
674 }
675 else
676 {
678 list.Add(items[l]);
679 }
680 }
681 for (int m = 0; m < list.Count; m++)
682 {
683 schema.Items.Remove(list[m]);
684 }
685 }
virtual int Add(object? value)
virtual bool Contains(object? item)
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
static string Sch_RedefineNoSchema
Definition SR.cs:948
static string Sch_InvalidNamespace
Definition SR.cs:790
static string Sch_MismatchTargetNamespaceImport
Definition SR.cs:598
static string Sch_MismatchTargetNamespaceInclude
Definition SR.cs:596
static string Sch_InvalidTargetNamespaceAttribute
Definition SR.cs:792
static string Sch_AttributeValueDataTypeDetailed
Definition SR.cs:496
static string Sch_ImportTargetNamespace
Definition SR.cs:798
static string Sch_InvalidNamespaceAttribute
Definition SR.cs:794
static string Sch_InvalidCollection
Definition SR.cs:1148
static string Sch_InvalidSchemaLocation
Definition SR.cs:796
static string Sch_MissRequiredAttribute
Definition SR.cs:490
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
void AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item)
void PreprocessAnnotation(XmlSchemaObject schemaObject)
void Preprocess(XmlSchema schema, string targetNamespace, ArrayList imports)
XmlSchema GetChameleonSchema(string targetNamespace, XmlSchema schema)
void ParseUri(string uri, string code, XmlSchemaObject sourceSchemaObject)
readonly Hashtable _processedExternals
void SetSchemaDefaults(XmlSchema schema)
void PreprocessAttribute(XmlSchemaAttribute attribute)
void SetParent(XmlSchemaObject child, XmlSchemaObject parent)
void BuildRefNamespaces(XmlSchema schema)
void PreprocessSimpleType(XmlSchemaSimpleType simpleType, bool local)
void PreprocessGroup(XmlSchemaGroup group)
void PreprocessElement(XmlSchemaElement element)
void Cleanup(XmlSchema schema)
void PreprocessNotation(XmlSchemaNotation notation)
void ValidateIdAttribute(XmlSchemaObject xso)
void PreprocessComplexType(XmlSchemaComplexType complexType, bool local)
void CopyIncludedComponents(XmlSchema includedSchema, XmlSchema schema)
void PreprocessAttributeGroup(XmlSchemaAttributeGroup attributeGroup)
void CleanupRedefine(XmlSchemaExternal include)

References System.Xml.Schema.Preprocessor._currentSchema, System.Xml.Schema.Preprocessor._processedExternals, System.Xml.Schema.Preprocessor._redefinedList, System.Xml.Schema.Preprocessor._rootSchema, System.Xml.Schema.Preprocessor._rootSchemaForRedefine, System.Xml.Schema.Preprocessor._targetNamespace, System.Collections.Hashtable.Add(), System.Collections.ArrayList.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Xml.Schema.BaseProcessor.AddToTable(), System.Xml.Schema.Preprocessor.BuildRefNamespaces(), System.Xml.Schema.Preprocessor.Cleanup(), System.Xml.Schema.Preprocessor.CleanupRedefine(), System.Collections.Hashtable.Clear(), System.Collections.Generic.Dictionary< TKey, TValue >.Contains(), System.Collections.ArrayList.Contains(), System.Xml.Schema.Preprocessor.CopyIncludedComponents(), System.Collections.CollectionBase.Count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.Schema.Preprocessor.GetChameleonSchema(), System.Xml.Schema.DatatypeImplementation.GetSimpleTypeFromTypeCode(), System.Xml.Schema.XmlSchema.ImportedNamespaces, System.Xml.Schema.Length, System.list, System.Xml.Schema.Preprocessor.ParseUri(), System.Xml.Schema.Preprocessor.Preprocess(), System.Xml.Schema.Preprocessor.PreprocessAnnotation(), System.Xml.Schema.Preprocessor.PreprocessAttribute(), System.Xml.Schema.Preprocessor.PreprocessAttributeGroup(), System.Xml.Schema.Preprocessor.PreprocessComplexType(), System.Xml.Schema.Preprocessor.PreprocessElement(), System.Xml.Schema.Preprocessor.PreprocessGroup(), System.Xml.Schema.Preprocessor.PreprocessNotation(), System.Xml.Schema.Preprocessor.PreprocessSimpleType(), System.Collections.Generic.Dictionary< TKey, TValue >.Remove(), System.SR.Sch_AttributeValueDataTypeDetailed, System.SR.Sch_ImportTargetNamespace, System.SR.Sch_InvalidCollection, System.SR.Sch_InvalidNamespace, System.SR.Sch_InvalidNamespaceAttribute, System.SR.Sch_InvalidSchemaLocation, System.SR.Sch_InvalidTargetNamespaceAttribute, System.SR.Sch_MismatchTargetNamespaceImport, System.SR.Sch_MismatchTargetNamespaceInclude, System.SR.Sch_MissRequiredAttribute, System.SR.Sch_RedefineNoSchema, System.Xml.Schema.BaseProcessor.SendValidationEvent(), System.Xml.Schema.Preprocessor.SetParent(), System.Xml.Schema.Preprocessor.SetSchemaDefaults(), System.Xml.Schema.XmlSchemaDatatype.TryParseValue(), and System.Xml.Schema.Preprocessor.ValidateIdAttribute().

Referenced by System.Xml.Schema.Preprocessor.Execute(), and System.Xml.Schema.Preprocessor.Preprocess().