private void ElementIdentityConstraints() { 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++) { if (constr[j].axisSelector.MoveToStartElement(base.reader.LocalName, base.reader.NamespaceURI)) { constr[j].axisSelector.PushKS(base.PositionInfo.LineNumber, base.PositionInfo.LinePosition); } for (int k = 0; k < constr[j].axisFields.Count; k++) { LocatedActiveAxis axis = (LocatedActiveAxis)constr[j].axisFields[k]; if (axis.MoveToStartElement(base.reader.LocalName, base.reader.NamespaceURI) && (base.context.ElementDecl != null)) { if (base.context.ElementDecl.Datatype == null) { base.SendValidationEvent("Sch_FieldSimpleTypeExpected", base.reader.LocalName); } else { axis.isMatched = true; } } } } } } }
private void ElementIdentityConstraints() { for (int i = this.startIDConstraint; i < this.validationStack.Length; i++) { // no constraint for this level if (((ValidationState)(this.validationStack[i])).Constr == null) { continue; } // else ConstraintStruct[] constraints = ((ValidationState)this.validationStack[i]).Constr; for (int j = 0; j < constraints.Length; ++j) { // check selector from here if (constraints[j].axisSelector.MoveToStartElement(reader.LocalName, reader.NamespaceURI)) { // selector selects new node, activate a new set of fields Debug.WriteLine("Selector Match!"); Debug.WriteLine("Name: " + reader.LocalName + "\t|\tURI: " + reader.NamespaceURI + "\n"); // in which axisFields got updated constraints[j].axisSelector.PushKS(PositionInfo.LineNumber, PositionInfo.LinePosition); } // axisFields is not null, but may be empty for (int k = 0; k < constraints[j].axisFields.Count; ++k) { LocatedActiveAxis laxis = (LocatedActiveAxis)constraints[j].axisFields[k]; // check field from here if (laxis.MoveToStartElement(reader.LocalName, reader.NamespaceURI)) { Debug.WriteLine("Element Field Match!"); // checking simpleType / simpleContent if (context.ElementDecl != null) // nextElement can be null when xml/xsd are not valid { if (context.ElementDecl.Datatype == null) { SendValidationEvent(Res.Sch_FieldSimpleTypeExpected, reader.LocalName); } else { // can't fill value here, wait till later.... // fill type : xsdType laxis.isMatched = true; // since it's simpletyped element, the endchildren will come consequently... don't worry } } } } } } }