TextEvent() private method

private TextEvent ( string text ) : bool
text string
return bool
示例#1
0
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);

            switch (frame.State)
            {
                case Initialized:
                    Debug.Assert(frame != null);
                    Debug.Assert(frame.NodeSet != null);

                    string value = processor.ValueOf(frame, _selectKey);

                    if (processor.TextEvent(value, _disableOutputEscaping))
                    {
                        frame.Finished();
                    }
                    else
                    {
                        frame.StoredOutput = value;
                        frame.State = ResultStored;
                    }
                    break;

                case ResultStored:
                    Debug.Assert(frame.StoredOutput != null);
                    processor.TextEvent(frame.StoredOutput);
                    frame.Finished();
                    break;

                default:
                    Debug.Fail("Invalid ValueOfAction execution state");
                    break;
            }
        }
示例#2
0
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);

            switch (frame.State)
            {
            case Initialized:
                Debug.Assert(frame != null);
                Debug.Assert(frame.NodeSet != null);

                string value = processor.ValueOf(frame.NodeSet.Current !);

                if (processor.TextEvent(value, /*disableOutputEscaping:*/ false))
                {
                    frame.Finished();
                }
                else
                {
                    frame.StoredOutput = value;
                    frame.State        = ResultStored;
                }
                break;

            case ResultStored:
                Debug.Assert(frame.StoredOutput != null);
                processor.TextEvent(frame.StoredOutput);
                frame.Finished();
                break;

            default:
                Debug.Fail("Invalid BuiltInRuleTextAction execution state");
                break;
            }
        }
示例#3
0
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);

            switch (frame.State)
            {
            case Initialized:
                Debug.Assert(frame.NodeSet != null);
                Query  query  = processor.GetValueQuery(_selectKey);
                object result = query.Evaluate(frame.NodeSet);

                if (result is XPathNodeIterator)
                {
                    // we cash this query because otherwise current() works incorrectly. Bug #382166.
                    // To be perfect we should use frame.NewNodeSet here
                    processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathArrayIterator(query));
                    frame.State = NodeSetCopied;
                    break;
                }

                XPathNavigator?nav = result as XPathNavigator;
                if (nav != null)
                {
                    processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathSingletonIterator(nav));
                    frame.State = NodeSetCopied;
                    break;
                }

                string?value = XmlConvert.ToXPathString(result);
                if (processor.TextEvent(value))
                {
                    frame.Finished();
                }
                else
                {
                    frame.StoredOutput = value;
                    frame.State        = ResultStored;
                }
                break;

            case ResultStored:
                Debug.Assert(frame.StoredOutput != null);
                processor.TextEvent(frame.StoredOutput);
                frame.Finished();
                break;

            case NodeSetCopied:
                Debug.Assert(frame.State == NodeSetCopied);
                frame.Finished();
                break;
            }
        }
示例#4
0
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);

            switch (frame.State)
            {
                case Initialized:
                    Debug.Assert(frame.NodeSet != null);
                    Query query = processor.GetValueQuery(_selectKey);
                    object result = query.Evaluate(frame.NodeSet);

                    if (result is XPathNodeIterator)
                    {
                        // we cash this query because otherwise current() works incorrectly. Bug#382166.
                        // To be perfect we should use frame.NewNodeSet here
                        processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathArrayIterator(query));
                        frame.State = NodeSetCopied;
                        break;
                    }

                    XPathNavigator nav = result as XPathNavigator;
                    if (nav != null)
                    {
                        processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathSingletonIterator(nav));
                        frame.State = NodeSetCopied;
                        break;
                    }

                    string value = XmlConvert.ToXPathString(result);
                    if (processor.TextEvent(value))
                    {
                        frame.Finished();
                    }
                    else
                    {
                        frame.StoredOutput = value;
                        frame.State = ResultStored;
                    }
                    break;

                case ResultStored:
                    Debug.Assert(frame.StoredOutput != null);
                    processor.TextEvent(frame.StoredOutput);
                    frame.Finished();
                    break;

                case NodeSetCopied:
                    Debug.Assert(frame.State == NodeSetCopied);
                    frame.Finished();
                    break;
            }
        }
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);

            switch (frame.State)
            {
            case Initialized:
                Debug.Assert(frame.NodeSet != null);
                Query  query  = processor.GetValueQuery(this.selectKey);
                object result = query.Evaluate(frame.NodeSet);

                if (result is XPathNodeIterator)
                {
                    processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathArrayIterator(query));
                    frame.State = NodeSetCopied;
                    break;
                }

                XPathNavigator nav = result as XPathNavigator;
                if (nav != null)
                {
                    processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathSingletonIterator(nav));
                    frame.State = NodeSetCopied;
                    break;
                }

                string value = XmlConvert.ToXPathString(result);
                if (processor.TextEvent(value))
                {
                    frame.Finished();
                }
                else
                {
                    frame.StoredOutput = value;
                    frame.State        = ResultStored;
                }
                break;

            case ResultStored:
                Debug.Assert(frame.StoredOutput != null);
                processor.TextEvent(frame.StoredOutput);
                frame.Finished();
                break;

            case NodeSetCopied:
                Debug.Assert(frame.State == NodeSetCopied);
                frame.Finished();
                break;
            }
        }
示例#6
0
        internal override void Execute(Processor processor, ActionFrame frame) {
            Debug.Assert(processor != null && frame != null);

            switch (frame.State) {
            case Initialized:
                if (processor.TextEvent(this.text, disableOutputEscaping)) {
                    frame.Finished();
                }
                break;

            default:
                Debug.Fail("Invalid execution state in TextAction");
                break;
            }
        }
示例#7
0
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);

            switch (frame.State)
            {
            case Initialized:
                if (processor.TextEvent(_text, _disableOutputEscaping))
                {
                    frame.Finished();
                }
                break;

            default:
                Debug.Fail("Invalid execution state in TextAction");
                break;
            }
        }
 private static bool SendTextEvent(Processor processor, XPathNavigator node) {
     Debug.Assert(node.NodeType == XPathNodeType.Attribute);
     return processor.TextEvent(node.Value);
 }
        internal override void Execute(Processor processor, ActionFrame frame) {
            Debug.Assert(processor != null && frame != null);
            ArrayList list = processor.NumberList;
            switch (frame.State) {
            case Initialized:
                Debug.Assert(frame != null);
                Debug.Assert(frame.NodeSet != null);
                list.Clear();
                if (this.valueKey != Compiler.InvalidQueryKey) {
                    list.Add(SimplifyValue(processor.Evaluate(frame, this.valueKey)));
                }
                else if (this.level == "any") {
                    int number = numberAny(processor, frame);
                    if (number != 0) {
                        list.Add(number);
                    }
                }
                else {
                    bool multiple = (this.level == "multiple");
                    XPathNavigator contextNode = frame.Node;         // context of xsl:number element. We using this node in MatchCountKey()
                    XPathNavigator countNode   = frame.Node.Clone(); // node we count for
                    if (countNode.NodeType == XPathNodeType.Attribute || countNode.NodeType == XPathNodeType.Namespace) {
                        countNode.MoveToParent();
                    }
                    while (moveToCount(countNode, processor, contextNode)) {
                        list.Insert(0, numberCount(countNode, processor, contextNode));
                        if(! multiple || ! countNode.MoveToParent()) {
                            break;
                        }
                    }
                    if(! checkFrom(processor, countNode)) {
                        list.Clear();
                    }
                }

                /*CalculatingFormat:*/
                frame.StoredOutput = Format(list,
                    this.formatAvt       == null ? this.formatTokens : ParseFormat(this.formatAvt.Evaluate(processor, frame)),
                    this.langAvt         == null ? this.lang         : this.langAvt        .Evaluate(processor, frame),
                    this.letterAvt       == null ? this.letter       : ParseLetter(this.letterAvt.Evaluate(processor, frame)),
                    this.groupingSepAvt  == null ? this.groupingSep  : this.groupingSepAvt .Evaluate(processor, frame),
                    this.groupingSizeAvt == null ? this.groupingSize : this.groupingSizeAvt.Evaluate(processor, frame)
                );
                goto case OutputNumber;
            case OutputNumber :
                Debug.Assert(frame.StoredOutput != null);
                if (! processor.TextEvent(frame.StoredOutput)) {
                    frame.State        = OutputNumber;
                    break;
                }
                frame.Finished();
                break;
            default:
                Debug.Fail("Invalid Number Action execution state");
                break;
            }
        }
 private static bool SendTextEvent(Processor processor, XPathNavigator node)
 {
     Debug.Assert(node.NodeType == XPathNodeType.Attribute);
     return(processor.TextEvent(node.Value));
 }
示例#11
0
 public override bool Output(Processor processor, ActionFrame frame)
 {
     return(processor.TextEvent(this.text));
 }
示例#12
0
 public override bool Output(Processor processor, ActionFrame frame) {
     Debug.Assert(key != Compiler.InvalidQueryKey);
     return processor.TextEvent(processor.EvaluateString(frame, this.key));
 }
        internal override void Execute(Processor processor, ActionFrame frame)
        {
            Debug.Assert(processor != null && frame != null);
            ArrayList list = processor.NumberList;

            switch (frame.State)
            {
            case Initialized:
                Debug.Assert(frame != null);
                Debug.Assert(frame.NodeSet != null);
                list.Clear();
                if (_valueKey != Compiler.InvalidQueryKey)
                {
                    list.Add(SimplifyValue(processor.Evaluate(frame, _valueKey)));
                }
                else if (_level == "any")
                {
                    int number = numberAny(processor, frame);
                    if (number != 0)
                    {
                        list.Add(number);
                    }
                }
                else
                {
                    bool           multiple    = (_level == "multiple");
                    XPathNavigator contextNode = frame.Node;           // context of xsl:number element. We using this node in MatchCountKey()
                    XPathNavigator countNode   = frame.Node.Clone();   // node we count for
                    if (countNode.NodeType == XPathNodeType.Attribute || countNode.NodeType == XPathNodeType.Namespace)
                    {
                        countNode.MoveToParent();
                    }
                    while (moveToCount(countNode, processor, contextNode))
                    {
                        list.Insert(0, numberCount(countNode, processor, contextNode));
                        if (!multiple || !countNode.MoveToParent())
                        {
                            break;
                        }
                    }
                    if (!checkFrom(processor, countNode))
                    {
                        list.Clear();
                    }
                }

                /*CalculatingFormat:*/
                frame.StoredOutput = Format(list,
                                            _formatAvt == null ? _formatTokens : ParseFormat(_formatAvt.Evaluate(processor, frame)),
                                            _langAvt == null ? _lang : _langAvt.Evaluate(processor, frame),
                                            _letterAvt == null ? _letter : ParseLetter(_letterAvt.Evaluate(processor, frame)),
                                            _groupingSepAvt == null ? _groupingSep : _groupingSepAvt.Evaluate(processor, frame),
                                            _groupingSizeAvt == null ? _groupingSize : _groupingSizeAvt.Evaluate(processor, frame)
                                            );
                goto case OutputNumber;

            case OutputNumber:
                Debug.Assert(frame.StoredOutput != null);
                if (!processor.TextEvent(frame.StoredOutput))
                {
                    frame.State = OutputNumber;
                    break;
                }
                frame.Finished();
                break;

            default:
                Debug.Fail("Invalid Number Action execution state");
                break;
            }
        }
 public override bool Output(Processor processor, ActionFrame frame)
 {
     Debug.Assert(key != Compiler.InvalidQueryKey);
     return(processor.TextEvent(processor.EvaluateString(frame, this.key)));
 }
示例#15
0
 public override bool Output(Processor processor, ActionFrame frame) {
     return processor.TextEvent(this.text);
 }