当前位置: 首页>>代码示例>>C#>>正文


C# Processor.Matches方法代码示例

本文整理汇总了C#中System.Xml.Xsl.XsltOld.Processor.Matches方法的典型用法代码示例。如果您正苦于以下问题:C# Processor.Matches方法的具体用法?C# Processor.Matches怎么用?C# Processor.Matches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Xsl.XsltOld.Processor的用法示例。


在下文中一共展示了Processor.Matches方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindTemplate

        internal TemplateAction FindTemplate(Processor processor, XPathNavigator navigator) {
            if (this.templates == null) {
                return null;
            }

            Debug.Assert(this.templates != null);
            for (int templateIndex = this.templates.Count - 1; templateIndex >= 0 ; templateIndex --) {
                TemplateAction action = (TemplateAction) this.templates[templateIndex];
                int matchKey = action.MatchKey;

                if (matchKey != Compiler.InvalidQueryKey) {
                    if (processor.Matches(navigator, matchKey)) {
                        return action;
                    }
                }
            }

            return null;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:19,代码来源:Templatemanager.cs

示例2: MatchCountKey

 private bool MatchCountKey(Processor processor, XPathNavigator contextNode, XPathNavigator nav){
     if (this.countKey != Compiler.InvalidQueryKey) {
         return processor.Matches(nav, this.countKey);
     }
     if (contextNode.Name == nav.Name && BasicNodeType(contextNode.NodeType) == BasicNodeType(nav.NodeType)) {
         return true;
     }
     return false;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:9,代码来源:numberaction.cs

示例3: moveToCount

 private bool moveToCount(XPathNavigator nav, Processor processor, XPathNavigator contextNode) {
     do {
         if (this.fromKey != Compiler.InvalidQueryKey && processor.Matches(nav, this.fromKey)) {
             return false;
         }
         if (MatchCountKey(processor, contextNode, nav)) {
             return true;
         }
     }while (nav.MoveToParent());
     return false;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:11,代码来源:numberaction.cs

示例4: checkFrom

 // check 'from' condition:
 // if 'from' exist it has to be ancestor-or-self for the nav
 private bool checkFrom(Processor processor, XPathNavigator nav) {
     if(this.fromKey == Compiler.InvalidQueryKey) {
         return true;
     }
     do {
         if (processor.Matches(nav, this.fromKey)) {
             return true;
         }
     }while (nav.MoveToParent());
     return false;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:13,代码来源:numberaction.cs

示例5: numberAny

        private int numberAny(Processor processor, ActionFrame frame) {
            int result = 0;
            // Our current point will be our end point in this search
            XPathNavigator endNode = frame.Node;
            if(endNode.NodeType == XPathNodeType.Attribute || endNode.NodeType == XPathNodeType.Namespace) {
                endNode = endNode.Clone();
                endNode.MoveToParent();
            }
            XPathNavigator startNode = endNode.Clone();

            if(this.fromKey != Compiler.InvalidQueryKey) {
                bool hitFrom = false;
                // First try to find start by traversing up. This gives the best candidate or we hit root
                do{
                    if(processor.Matches(startNode, this.fromKey)) {
                        hitFrom = true;
                        break;
                    }
                }while(startNode.MoveToParent());

                Debug.Assert(
                    processor.Matches(startNode, this.fromKey) ||   // we hit 'from' or
                    startNode.NodeType == XPathNodeType.Root        // we are at root
                );

                // from this point (matched parent | root) create descendent quiery:
                // we have to reset 'result' on each 'from' node, because this point can' be not last from point;
                XPathNodeIterator  sel = startNode.SelectDescendants(XPathNodeType.All, /*matchSelf:*/ true);
                while (sel.MoveNext()) {
                    if(processor.Matches(sel.Current, this.fromKey)) {
                        hitFrom = true;
                        result = 0;
                    }
                    else if(MatchCountKey(processor, frame.Node, sel.Current)) {
                        result ++;
                    }
                    if(sel.Current.IsSamePosition(endNode)) {
                        break;
                    }
                }
                if(! hitFrom) {
                    result = 0;
                }
            }
            else {
                // without 'from' we startting from the root
                startNode.MoveToRoot();
                XPathNodeIterator  sel = startNode.SelectDescendants(XPathNodeType.All, /*matchSelf:*/ true);
                // and count root node by itself
                while (sel.MoveNext()) {
                    if (MatchCountKey(processor, frame.Node, sel.Current)) {
                        result ++;
                    }
                    if (sel.Current.IsSamePosition(endNode)) {
                        break;
                    }
                }
            }
            return result;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:60,代码来源:numberaction.cs

示例6: PreserveWhiteSpace

 internal bool PreserveWhiteSpace(Processor proc, XPathNavigator node){
     // last one should win. I.E. We starting from the end. I.E. Lowest priority should go first
     if (this.whitespaceList != null) {
         for (int i = this.whitespaceList.Count - 1; 0 <= i; i --) {
             WhitespaceElement elem = (WhitespaceElement) this.whitespaceList[i];
             if (proc.Matches(node, elem.Key)) {
                 return elem.PreserveSpace;
             }
         }
     }
     if (this.imports != null) {
         for (int importIndex = this.imports.Count - 1; importIndex >= 0; importIndex --) {
             Stylesheet stylesheet = (Stylesheet) this.imports[importIndex];
             if (! stylesheet.PreserveWhiteSpace(proc, node))
                 return false;
         }
     }
     return true;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:19,代码来源:Stylesheet.cs


注:本文中的System.Xml.Xsl.XsltOld.Processor.Matches方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。