private void AttributeIdentityConstraints(string name, string ns, object obj, string sobj, SchemaAttDef attdef) { for (int i = this.startIDConstraint; i < this.validationStack.Length; i++) { if (((ValidationState)this.validationStack[i]).Constr != null) { ConstraintStruct[] constr = ((ValidationState)this.validationStack[i]).Constr; for (int j = 0; j < constr.Length; j++) { for (int k = 0; k < constr[j].axisFields.Count; k++) { LocatedActiveAxis axis = (LocatedActiveAxis)constr[j].axisFields[k]; if (axis.MoveToAttribute(name, ns)) { if (axis.Ks[axis.Column] != null) { base.SendValidationEvent("Sch_FieldSingleValueExpected", name); } else if ((attdef != null) && (attdef.Datatype != null)) { axis.Ks[axis.Column] = new TypedObject(obj, sobj, attdef.Datatype); } } } } } } }
// facilitate modifying private void AttributeIdentityConstraints(string name, string ns, object obj, string sobj, SchemaAttDef attdef) { for (int ci = this.startIDConstraint; ci < this.validationStack.Length; ci++) { // no constraint for this level if (((ValidationState)(this.validationStack[ci])).Constr == null) { continue; } // else ConstraintStruct[] constraints = ((ValidationState)this.validationStack[ci]).Constr; for (int i = 0; i < constraints.Length; ++i) { // axisFields is not null, but may be empty for (int j = 0; j < constraints[i].axisFields.Count; ++j) { LocatedActiveAxis laxis = (LocatedActiveAxis)constraints[i].axisFields[j]; // check field from here if (laxis.MoveToAttribute(name, ns)) { Debug.WriteLine("Attribute Field Match!"); //attribute is only simpletype, so needn't checking... // can fill value here, yeah!! Debug.WriteLine("Attribute Field Filling Value!"); Debug.WriteLine("Name: " + name + "\t|\tURI: " + ns + "\t|\tValue: " + obj + "\n"); if (laxis.Ks[laxis.Column] != null) { // should be evaluated to either an empty node-set or a node-set with exactly one member // two matches... SendValidationEvent(Res.Sch_FieldSingleValueExpected, name); } else if ((attdef != null) && (attdef.Datatype != null)) { laxis.Ks[laxis.Column] = new TypedObject(obj, sobj, attdef.Datatype); } } } } } }