internal XElement ExecuteFSM(IEnumerator<XElement> enumerator, XName requestingXName, WildCard requestingWildCard) { XElement currElem = null; WildCard matchingWildCard = null; XName matchingName = null; while(enumerator.MoveNext()){ currElem = enumerator.Current; currentState = FsmMakeTransition(currentState, currElem.Name, out matchingName, out matchingWildCard); if (currentState!= FSM.InvalidState) { if ( (requestingXName != null) && (matchingName != null)) { if (requestingXName.Equals(currElem.Name)) return currElem; } else if ( (requestingWildCard != null) && (matchingWildCard != null) ){//requesting for ANY if (requestingWildCard.Allows(currElem.Name)) //Make sure current element is allowed by requesting ANY property return currElem; } } else {//Get stuck. No recovery attempt is provided for now. return null; } } //No matching elements/wildcards are found return null; }
private static bool Compare(XName first, XName second) { return first.Equals(second); }