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

◆ EndElementIdentityConstraints()

void System.Xml.Schema.XsdValidator.EndElementIdentityConstraints ( )
inlineprivate

Definition at line 928 of file XsdValidator.cs.

929 {
930 for (int num = _validationStack.Length - 1; num >= _startIDConstraint; num--)
931 {
932 if (((ValidationState)_validationStack[num]).Constr != null)
933 {
934 ConstraintStruct[] constr = ((ValidationState)_validationStack[num]).Constr;
935 for (int i = 0; i < constr.Length; i++)
936 {
937 for (int j = 0; j < constr[i].axisFields.Count; j++)
938 {
939 LocatedActiveAxis locatedActiveAxis = (LocatedActiveAxis)constr[i].axisFields[j];
940 if (locatedActiveAxis.isMatched)
941 {
943 if (locatedActiveAxis.Ks[locatedActiveAxis.Column] != null)
944 {
946 }
947 else
948 {
949 string text = ((!hasSibling) ? textString : textValue.ToString());
950 if (reader.TypedValueObject != null && text.Length != 0)
951 {
953 }
954 }
955 }
957 }
958 if (!constr[i].axisSelector.EndElement(reader.LocalName, reader.NamespaceURI))
959 {
960 continue;
961 }
962 KeySequence keySequence = constr[i].axisSelector.PopKS();
963 switch (constr[i].constraint.Role)
964 {
965 case CompiledIdentityConstraint.ConstraintRole.Key:
966 if (!keySequence.IsQualified())
967 {
968 SendValidationEvent(new XmlSchemaException(System.SR.Sch_MissingKey, constr[i].constraint.name.ToString(), reader.BaseURI, keySequence.PosLine, keySequence.PosCol));
969 }
970 else if (constr[i].qualifiedTable.Contains(keySequence))
971 {
972 SendValidationEvent(new XmlSchemaException(System.SR.Sch_DuplicateKey, new string[2]
973 {
974 keySequence.ToString(),
975 constr[i].constraint.name.ToString()
976 }, reader.BaseURI, keySequence.PosLine, keySequence.PosCol));
977 }
978 else
979 {
980 constr[i].qualifiedTable.Add(keySequence, keySequence);
981 }
982 break;
983 case CompiledIdentityConstraint.ConstraintRole.Unique:
984 if (keySequence.IsQualified())
985 {
986 if (constr[i].qualifiedTable.Contains(keySequence))
987 {
988 SendValidationEvent(new XmlSchemaException(System.SR.Sch_DuplicateKey, new string[2]
989 {
990 keySequence.ToString(),
991 constr[i].constraint.name.ToString()
992 }, reader.BaseURI, keySequence.PosLine, keySequence.PosCol));
993 }
994 else
995 {
996 constr[i].qualifiedTable.Add(keySequence, keySequence);
997 }
998 }
999 break;
1000 case CompiledIdentityConstraint.ConstraintRole.Keyref:
1001 if (constr[i].qualifiedTable != null && keySequence.IsQualified() && !constr[i].qualifiedTable.Contains(keySequence))
1002 {
1003 constr[i].qualifiedTable.Add(keySequence, keySequence);
1004 }
1005 break;
1006 }
1007 }
1008 }
1009 }
1010 ConstraintStruct[] constr2 = ((ValidationState)_validationStack[_validationStack.Length - 1]).Constr;
1011 if (constr2 == null)
1012 {
1013 return;
1014 }
1015 for (int k = 0; k < constr2.Length; k++)
1016 {
1017 if (constr2[k].constraint.Role == CompiledIdentityConstraint.ConstraintRole.Keyref || constr2[k].keyrefTable == null)
1018 {
1019 continue;
1020 }
1021 foreach (KeySequence key in constr2[k].keyrefTable.Keys)
1022 {
1023 if (!constr2[k].qualifiedTable.Contains(key))
1024 {
1025 SendValidationEvent(new XmlSchemaException(System.SR.Sch_UnresolvedKeyref, new string[2]
1026 {
1027 key.ToString(),
1028 constr2[k].constraint.name.ToString()
1029 }, reader.BaseURI, key.PosLine, key.PosCol));
1030 }
1031 }
1032 }
1033 }
static string Sch_UnresolvedKeyref
Definition SR.cs:732
static string Sch_MissingKey
Definition SR.cs:742
static string Sch_DuplicateKey
Definition SR.cs:744
static string Sch_FieldSingleValueExpected
Definition SR.cs:740
Definition SR.cs:7
void SendValidationEvent(string code)
XmlValidatingReaderImpl reader

References System.Xml.Schema.XsdValidator._startIDConstraint, System.Xml.Schema.XsdValidator._validationStack, System.Xml.XmlValidatingReaderImpl.BaseURI, System.Xml.Schema.BaseValidator.context, System.Xml.Schema.SchemaDeclBase.Datatype, System.Xml.Dictionary, System.Xml.Schema.ValidationState.ElementDecl, System.Xml.Schema.BaseValidator.hasSibling, System.key, System.Xml.HWStack.Length, System.Xml.XmlValidatingReaderImpl.LocalName, System.Xml.XmlValidatingReaderImpl.NamespaceURI, System.Xml.Schema.BaseValidator.reader, System.SR.Sch_DuplicateKey, System.SR.Sch_FieldSingleValueExpected, System.SR.Sch_MissingKey, System.SR.Sch_UnresolvedKeyref, System.Xml.Schema.BaseValidator.SendValidationEvent(), System.text, System.Xml.Schema.BaseValidator.textString, System.Xml.Schema.BaseValidator.textValue, System.Text.StringBuilder.ToString(), and System.Xml.XmlValidatingReaderImpl.TypedValueObject.

Referenced by System.Xml.Schema.XsdValidator.ValidateEndElement().