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


C# XPathExpression.SetContext方法代码示例

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


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

示例1: LiveExampleComponent

        public LiveExampleComponent(BuildAssembler assembler, XPathNavigator configuration)
            : base(assembler, configuration) {

            XPathNavigator parsnip_node = configuration.SelectSingleNode("parsnip");
            string approvedFile = null;
            if (parsnip_node != null) {
                approvedFile = parsnip_node.GetAttribute("approved-file", String.Empty);

                string omitBadExamplesValue = parsnip_node.GetAttribute("omit-bad-examples", String.Empty);
                if (!string.IsNullOrEmpty(omitBadExamplesValue))
                    omitBadExamples = Boolean.Parse(omitBadExamplesValue);

                //string runBadExamplesValue = parsnip_node.GetAttribute("run-bad-examples", String.Empty);
                //if (!string.IsNullOrEmpty(runBadExamplesValue))
                //    runBadExamples = Boolean.Parse(runBadExamplesValue);
            }

            if (string.IsNullOrEmpty(approvedFile))
                WriteMessage(MessageLevel.Warn, "No approved samples file specified; all available samples will be included.");
            else
                LoadApprovedFile(approvedFile);

            context = new CustomContext();
            context.AddNamespace("ddue", "http://ddue.schemas.microsoft.com/authoring/2003/5");

            selector = XPathExpression.Compile("//ddue:codeReference");
            selector.SetContext(context);
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:28,代码来源:LiveExampleComponent.cs

示例2: Processor

 static Processor()
 {
     XPathNavigator nav = new XmlDocument().CreateNavigator();
     // Select all extension types.
     Extensions = nav.Compile("/processing-instruction('extension')");
     PostExts = nav.Compile("/processing-instruction('post-process')");
     // Create and set namespace resolution context.
     XmlNamespaceManager nsmgr = new XmlNamespaceManager(nav.NameTable);
     nsmgr.AddNamespace("xs", XmlSchema.Namespace);
     nsmgr.AddNamespace("kzu", ExtensionNamespace);
     Extensions.SetContext(nsmgr);
 }
开发者ID:wskplho,项目名称:Tools,代码行数:12,代码来源:Processor.cs

示例3: XmlSchemaParser

        static XmlSchemaParser()
        {
            XPathNavigator nav = new XmlDocument().CreateNavigator();
            // Select all extension types.
            Extensions = nav.Compile( "/xs:schema/xs:annotation/xs:appinfo/kzu:Code/kzu:Extension/@Type" );

            // Create and set namespace resolution context.
            XmlNamespaceManager nsmgr = new XmlNamespaceManager( nav.NameTable );
            nsmgr.AddNamespace( "xs", XmlSchema.Namespace );
            nsmgr.AddNamespace( "kzu", ExtensionNamespace );
            Extensions.SetContext( nsmgr );
        }
开发者ID:Gufalagupagup,项目名称:raml-dotnet-tools,代码行数:12,代码来源:XmlSchemaParser.cs

示例4: 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

示例5: SelectSingleNode

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

示例6: Evaluate

		public bool Evaluate(XPathExpression xpath, XPathNavigator source, out object result)
		{
			xpath = (XPathExpression)xpath.Clone();
			xpath.SetContext(this);
			result = source.Evaluate(xpath);
			if (xpath.ReturnType == XPathResultType.NodeSet)	
			{
				if (((XPathNodeIterator)result).Count == 0)
					result = null;
			}
			return result != null;
		}
开发者ID:n2cms,项目名称:Castle.Core,代码行数:12,代码来源:XPathContext.cs

示例7: findXPath

 /// <summary>
 /// This method sets the inherent XPathNodeIterator instance.
 /// </summary>
 /// <param name="xPath">A compiled XPath expression</param>
 private void findXPath(XPathExpression xPath)
 {
     xPath.SetContext(_ParamContext);
     _XIter = _XNav.Select(xPath);
     InitializeCustomContext(_ParamContext);
 }
开发者ID:HackatonArGP,项目名称:Guardianes,代码行数:10,代码来源:XPathQueryManager.cs

示例8: Compile

        internal void Compile(XPathNavigator nav)
        {
            if(Status == XPathSelectorStatus.Start)
            {
                GetXPath(nav);
            }
            if(Status == XPathSelectorStatus.Parsed)
            {
                xpath = nav.Compile(sXpath);
                xpath.SetContext(GetNSManager());

                Status = XPathSelectorStatus.Compiled;
            }
        }
开发者ID:udayanroy,项目名称:SvgSharp,代码行数:14,代码来源:CssXPathSelector.cs

示例9: FindXPath

 /// <summary>
 /// This method sets the inherent XPathNodeIterator instance.
 /// </summary>
 /// <param name="xPath">A compiled XPath expression</param>
 private void FindXPath(XPathExpression xPath)
 {
     xPath.SetContext(_paramContext);
     _xIter = _xNav.Select(xPath);
     InitializeCustomContext(_paramContext);
 }
开发者ID:pauldendulk,项目名称:Mapsui,代码行数:10,代码来源:XPathQueryManager.cs

示例10: Initialize

        //=====================================================================

        /// <inheritdoc />
        public override void Initialize(XPathNavigator configuration)
        {
            XPathNodeIterator contentNodes = configuration.Select("examples");

            foreach(XPathNavigator contentNode in contentNodes)
            {
                string file = contentNode.GetAttribute("file", String.Empty);
                file = Environment.ExpandEnvironmentVariables(file);

                if(String.IsNullOrEmpty(file))
                    WriteMessage(MessageLevel.Error, "Each examples element must contain a file attribute.");

                LoadContent(file);
            }

            WriteMessage(MessageLevel.Info, "Loaded {0} code snippets", snippets.Count);

            XPathNodeIterator colorsNodes = configuration.Select("colors");

            foreach(XPathNavigator colorsNode in colorsNodes)
            {
                string language = colorsNode.GetAttribute("language", String.Empty);
                List<ColorizationRule> rules = new List<ColorizationRule>();

                XPathNodeIterator colorNodes = colorsNode.Select("color");

                foreach(XPathNavigator colorNode in colorNodes)
                {
                    string pattern = colorNode.GetAttribute("pattern", String.Empty);
                    string region = colorNode.GetAttribute("region", String.Empty);
                    string name = colorNode.GetAttribute("class", String.Empty);

                    if(String.IsNullOrEmpty(region))
                        rules.Add(new ColorizationRule(pattern, name));
                    else
                        rules.Add(new ColorizationRule(pattern, region, name));
                }

                colorization[language] = rules;
                WriteMessage(MessageLevel.Info, "Loaded {0} colorization rules for the language '{1}'.", rules.Count, language);
            }

            context.AddNamespace("ddue", "http://ddue.schemas.microsoft.com/authoring/2003/5");

            selector = XPathExpression.Compile("//ddue:codeReference");
            selector.SetContext(context);
        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:50,代码来源:ExampleComponent.cs

示例11: 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

示例12: Evaluate

		public override object Evaluate (XPathExpression expr, XPathNodeIterator context) {
			expr.SetContext(nswrap);
			return base.Evaluate(expr, context);
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:4,代码来源:XPathSemWebNavigator.cs

示例13: Select

		public override XPathNodeIterator Select (XPathExpression expr) {
			expr.SetContext(nswrap);
			return base.Select(expr);
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:4,代码来源:XPathSemWebNavigator.cs

示例14: InitXPathExpression

		protected void InitXPathExpression(string strXPathExpr, ref XPathExpression xpe)
		{
			XPathNavigator navigator = CreateNavigator();
			xpe = navigator.Compile(strXPathExpr);
			XmlNamespaceManager manager;
			GetNamespaceManager(navigator, out manager);
			xpe.SetContext(manager);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:8,代码来源:DocXmlDocument.cs


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