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


C# XPathNavigator.Matches方法代码示例

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


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

示例1: GetNodeXPath

	public override string GetNodeXPath (XPathNavigator n)
	{
		if (n.Matches ("/Type/Docs/param")) {
			string type_name = (string) n.Evaluate ("string (ancestor::Type/@FullName)");
			string param_name = (string) n.Evaluate ("string (@name)");
			
			return String.Format ("/Type [@FullName = '{0}']/Docs/param[@name='{1}']", type_name, param_name);
		}

		if (n.Matches ("/Type/Docs/*")) {
			string type_name = (string) n.Evaluate ("string (ancestor::Type/@FullName)");
			
			return String.Format ("/Type [@FullName = '{0}']/Docs/{1}", type_name, n.Name);
		}
		
		if (n.Matches ("/Type/Members/Member/Docs/*")) {
			string type_name = (string) n.Evaluate ("string (ancestor::Type/@FullName)");
			string member_name = (string) n.Evaluate ("string (ancestor::Member/@MemberName)");
			string member_sig = (string) n.Evaluate ("string (ancestor::Member/MemberSignature [@Language='C#']/@Value)");
			string param_name = (string) n.Evaluate ("string (@name)");
			
			if (param_name == null || param_name == "") {
				return String.Format (
				"/Type [@FullName = '{0}']/Members/Member [@MemberName = '{1}'][MemberSignature [@Language='C#']/@Value = '{2}']/Docs/{3}",
				type_name, member_name, member_sig, n.Name);
			} else {
				return String.Format (
				"/Type [@FullName = '{0}']/Members/Member [@MemberName = '{1}'][MemberSignature [@Language='C#']/@Value = '{2}']/Docs/param [@name = '{3}']",
				type_name, member_name, member_sig, param_name);
			}
		}
		
		Message (TraceLevel.Warning, "WARNING: Was not able to get clean XPath expression for node {0}", EditingUtils.GetXPath (n));
		return base.GetNodeXPath (n);
	}
开发者ID:RAOF,项目名称:mono,代码行数:35,代码来源:ecma-provider.cs

示例2: Matches

		public bool Matches(XPathExpression xpath, XPathNavigator source)
		{
			xpath = (XPathExpression)xpath.Clone();
			xpath.SetContext(this);
			return source.Matches(xpath);
		}
开发者ID:n2cms,项目名称:Castle.Core,代码行数:6,代码来源:XPathContext.cs

示例3: Matches

 public bool Matches(XPathNavigator nav)
 {
     if(Status != XPathSelectorStatus.Compiled)
     {
         Compile(nav);
     }
     if(Status == XPathSelectorStatus.Compiled)
     {
         try
         {
             return nav.Matches(xpath);
         }
         catch
         {
             return false;
         }
     }
     else
     {
         return false;
     }
 }
开发者ID:udayanroy,项目名称:SvgSharp,代码行数:22,代码来源:CssXPathSelector.cs

示例4: MatchNode

 /// <summary>
 /// Matches given node against "match" pattern and adds it to 
 /// the index table if the matching succeeded.
 /// </summary>
 /// <param name="node">Node to match</param>
 public void MatchNode(XPathNavigator node)
 {
     foreach (KeyDef keyDef in keys)
     {
         if (node.Matches(keyDef.MatchExpr))
         {
             //Ok, let's calculate key value(s). As per XSLT spec:
             //If the result is a node-set, then for each node in the node-set,
             //the node that matches the pattern has a key of the specified name whose
             //value is the string-value of the node in the node-set; otherwise, the result
             //is converted to a string, and the node that matches the pattern has a
             //key of the specified name with value equal to that string.
             object key = node.Evaluate(keyDef.UseExpr);
             if (key is XPathNodeIterator)
             {
                 XPathNodeIterator ni = (XPathNodeIterator)key;
                 while (ni.MoveNext())
                     AddNodeToIndex(node, ni.Current.Value);
             }
             else
             {
                 AddNodeToIndex(node, key.ToString());
             }
         }
     }
 }
开发者ID:Monobjc,项目名称:monobjc-tools,代码行数:31,代码来源:IndexingXPathNavigator.cs

示例5: Matches

 internal bool Matches(XPathNavigator context, int key) {
     return context.Matches(GetValueQuery(key));
 }
开发者ID:ArildF,项目名称:masters,代码行数:3,代码来源:processor.cs

示例6: IsMatch

        public bool IsMatch(XPathNavigator xpn, XmlNamespaceManager xnm)
        {
            if ( xpathExpression == null )
            {
                xpathExpression=xpn.Compile(xpath);
                xpathExpression.SetContext(xnm);
            }

            return xpn.Matches(xpathExpression);

            //			Debug.Assert(e.Name.Equals(name), "IsMatch called for incorrect element!");
            //			// TODO: L: bit messy
            //			return Conditions == null || Conditions.Conditions ==null ||
            //				Conditions.Conditions.Count == 0 || Conditions.MatchesAll(e);
        }
开发者ID:jugglingcats,项目名称:XEditNet,代码行数:15,代码来源:Styles.cs


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