private void ElementIdentityConstraints()
{
SchemaElementDecl currentElementDecl = _context.ElementDecl;
string localName = _context.LocalName;
string namespaceUri = _context.Namespace;
for (int i = _startIDConstraint; i < _validationStack.Length; i++)
{
// no constraint for this level
if (((ValidationState)(_validationStack[i])).Constr == null)
{
continue;
}
// else
ConstraintStruct[] constraintStructures = ((ValidationState)_validationStack[i]).Constr;
for (int j = 0; j < constraintStructures.Length; ++j)
{
// check selector from here
if (constraintStructures[j].axisSelector.MoveToStartElement(localName, namespaceUri))
{
// selector selects new node, activate a new set of fields
Debug.WriteLine("Selector Match!");
Debug.WriteLine("Name: " + localName + "\t|\tURI: " + namespaceUri + "\n");
// in which axisFields got updated
constraintStructures[j].axisSelector.PushKS(_positionInfo.LineNumber, _positionInfo.LinePosition);
}
// axisFields is not null, but may be empty
for (int k = 0; k < constraintStructures[j].axisFields.Count; ++k)
{
LocatedActiveAxis laxis = (LocatedActiveAxis)constraintStructures[j].axisFields[k];
// check field from here
if (laxis.MoveToStartElement(localName, namespaceUri))
{
Debug.WriteLine("Element Field Match!");
// checking simpleType / simpleContent
if (currentElementDecl != null)
{ // nextElement can be null when xml/xsd are not valid
if (currentElementDecl.Datatype == null || currentElementDecl.ContentValidator.ContentType == XmlSchemaContentType.Mixed)
{
SendValidationEvent(SR.Sch_FieldSimpleTypeExpected, 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
}
}
}
}
}
}
}