NextNode() приватный Метод

private NextNode ( Processor proc ) : bool
proc Processor
Результат bool
Пример #1
0
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);

            switch (frame.State)
            {
            case Initialized:
                frame.AllocateVariables(variableCount);
                XPathNavigator root = processor.Document.Clone();
                root.MoveToRoot();
                frame.InitNodeSet(new XPathSingletonIterator(root));

                if (this.containedActions != null && this.containedActions.Count > 0)
                {
                    processor.PushActionFrame(frame);
                }
                frame.State = QueryInitialized;
                break;

            case QueryInitialized:
                Debug.Assert(frame.State == QueryInitialized);
                frame.NextNode(processor);
                Debug.Assert(Processor.IsRoot(frame.Node));
                if (processor.Debugger != null)
                {
                    // this is like apply-templates, but we don't have it on stack.
                    // Pop the stack, otherwise last instruction will be on it.
                    processor.PopDebuggerStack();
                }
                processor.PushTemplateLookup(frame.NodeSet, /*mode:*/ null, /*importsOf:*/ null);

                frame.State = RootProcessed;
                break;

            case RootProcessed:
                Debug.Assert(frame.State == RootProcessed);
                frame.Finished();
                break;

            default:
                Debug.Fail("Invalid RootAction execution state");
                break;
            }
        }
        internal override void Execute(Processor processor, ActionFrame frame) {
            Debug.Assert(processor != null && frame != null);
            while (processor.CanContinue) {
                switch (frame.State) {
                case Initialized:
                    if (frame.NextNode(processor)) {
                        frame.State = BeginEvent;
                        goto case BeginEvent;
                    }
                    else {
                        frame.Finished();
                        break;
                    }
                case BeginEvent:
                    Debug.Assert(frame.State == BeginEvent);

                    if (SendBeginEvent(processor, frame.Node) == false) {
                        // This one wasn't output
                        break;
                    }
                    frame.State = Contents;
                    continue;

                case Contents:
                    Debug.Assert(frame.State == Contents);
                    XPathNodeType nodeType = frame.Node.NodeType;

                    if (nodeType == XPathNodeType.Element || nodeType == XPathNodeType.Root) {
                        processor.PushActionFrame(CopyNamespacesAction.GetAction(), frame.NodeSet);
                        frame.State = Namespaces;
                        break;
                    }

                    if (SendTextEvent(processor, frame.Node) == false) {
                        // This one wasn't output
                        break;
                    }
                    frame.State = EndEvent;
                    continue;

                case Namespaces:
                    processor.PushActionFrame(CopyAttributesAction.GetAction(), frame.NodeSet);
                    frame.State = Attributes;
                    break;

                case Attributes:
                    if (frame.Node.HasChildren) {
                        processor.PushActionFrame(GetAction(), frame.Node.SelectChildren(XPathNodeType.All));
                        frame.State = Subtree;
                        break;
                    }
                    frame.State = EndEvent;
                    goto case EndEvent;

                case Subtree:
                    //frame.Node.MoveToParent();
                    frame.State = EndEvent;
                    continue;

                case EndEvent:
                    Debug.Assert(frame.State == EndEvent);

                    if (SendEndEvent(processor, frame.Node) == false) {
                        // This one wasn't output
                        break;
                    }

                    frame.State = Initialized;
                    continue;
                }

                break;
            }
        }
Пример #3
0
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);
            while (processor.CanContinue)
            {
                switch (frame.State)
                {
                case Initialized:
                    if (frame.NextNode(processor))
                    {
                        frame.State = BeginEvent;
                        goto case BeginEvent;
                    }
                    else
                    {
                        frame.Finished();
                        break;
                    }

                case BeginEvent:
                    Debug.Assert(frame.State == BeginEvent);

                    if (SendBeginEvent(processor, frame.Node) == false)
                    {
                        // This one wasn't output
                        break;
                    }
                    frame.State = Contents;
                    continue;

                case Contents:
                    Debug.Assert(frame.State == Contents);
                    XPathNodeType nodeType = frame.Node.NodeType;

                    if (nodeType == XPathNodeType.Element || nodeType == XPathNodeType.Root)
                    {
                        processor.PushActionFrame(CopyNamespacesAction.GetAction(), frame.NodeSet);
                        frame.State = Namespaces;
                        break;
                    }

                    if (SendTextEvent(processor, frame.Node) == false)
                    {
                        // This one wasn't output
                        break;
                    }
                    frame.State = EndEvent;
                    continue;

                case Namespaces:
                    processor.PushActionFrame(CopyAttributesAction.GetAction(), frame.NodeSet);
                    frame.State = Attributes;
                    break;

                case Attributes:
                    if (frame.Node.HasChildren)
                    {
                        processor.PushActionFrame(GetAction(), frame.Node.SelectChildren(XPathNodeType.All));
                        frame.State = Subtree;
                        break;
                    }
                    frame.State = EndEvent;
                    goto case EndEvent;

                case Subtree:
                    //frame.Node.MoveToParent();
                    frame.State = EndEvent;
                    continue;

                case EndEvent:
                    Debug.Assert(frame.State == EndEvent);

                    if (SendEndEvent(processor, frame.Node) == false)
                    {
                        // This one wasn't output
                        break;
                    }

                    frame.State = Initialized;
                    continue;
                }

                break;
            }
        }
Пример #4
0
       internal override void Execute(Processor processor, ActionFrame frame) {
            Debug.Assert(processor != null && frame != null);

            switch (frame.State) {
            case Initialized:
                frame.AllocateVariables(variableCount);
                XPathNavigator root = processor.Document.Clone();
                root.MoveToRoot();
                frame.InitNodeSet(new XPathSingletonIterator(root));
               
                if (this.containedActions != null && this.containedActions.Count > 0) {
                    processor.PushActionFrame(frame);
                }
                frame.State = QueryInitialized;
                break;
            case QueryInitialized:
                Debug.Assert(frame.State == QueryInitialized);
                frame.NextNode(processor);
                Debug.Assert(Processor.IsRoot(frame.Node));
                if (processor.Debugger != null) {
                    // this is like apply-templates, but we don't have it on stack. 
                    // Pop the stack, otherwise last instruction will be on it.
                    processor.PopDebuggerStack();
                }
                processor.PushTemplateLookup(frame.NodeSet, /*mode:*/null, /*importsOf:*/null);

                frame.State = RootProcessed;
                break;

            case RootProcessed:
                Debug.Assert(frame.State == RootProcessed);
                frame.Finished();
                break;
            default:
                Debug.Fail("Invalid RootAction execution state");
		        break;
            }
        }