System.Xml.Schema.NfaContentValidator.ValidateElement C# (CSharp) Method

ValidateElement() public method

Algorithm 3.4 Simulation of an NFA
public ValidateElement ( XmlQualifiedName name, ValidationState context, int &errorCode ) : object
name XmlQualifiedName
context ValidationState
errorCode int
return object
        public override object ValidateElement(XmlQualifiedName name, ValidationState context, out int errorCode) {
            BitSet curpos = context.CurPos[context.CurrentState.CurPosIndex];
            int next = (context.CurrentState.CurPosIndex + 1) % 2;
            BitSet nextpos = context.CurPos[next];
            nextpos.Clear();
            int symbol = symbols[name];
            object particle = null;
            errorCode = 0;
            for (int pos = curpos.NextSet(-1); pos != -1; pos = curpos.NextSet(pos)) {
                // if position can follow
                if (symbol == positions[pos].symbol) {
                    nextpos.Or(followpos[pos]);
                    particle = positions[pos].particle; //Between element and wildcard, element will be in earlier pos than wildcard since we add the element nodes to the list of positions first
                    break;                              // and then ExpandTree for the namespace nodes which adds the wildcards to the positions list
                }
            }
            if (!nextpos.IsEmpty) {
                context.CurrentState.CurPosIndex = next;
                return particle;
            }
            if (IsOpen && curpos[endMarkerPos]) {
                // XDR allows any well-formed contents after matched.
                return null;
            }
            context.NeedValidateChildren = false;
            errorCode = -1;
            return null; // will never be here

        }