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


C# XPath.XPathNodeIterator类代码示例

本文整理汇总了C#中System.Xml.XPath.XPathNodeIterator的典型用法代码示例。如果您正苦于以下问题:C# XPathNodeIterator类的具体用法?C# XPathNodeIterator怎么用?C# XPathNodeIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XPathNodeIterator类属于System.Xml.XPath命名空间,在下文中一共展示了XPathNodeIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DebuggerOptions

        internal DebuggerOptions(XPathNodeIterator iter)
        {
            while (iter.MoveNext ()) {
                switch (iter.Current.Name) {
                case "File":
                    file = iter.Current.Value;
                    break;
                case "InferiorArgs":
                    append_array (ref inferior_args, iter.Current.Value);
                    break;
                case "JitArguments":
                    append_array (ref jit_arguments, iter.Current.Value);
                    break;
                case "WorkingDirectory":
                    WorkingDirectory = iter.Current.Value;
                    break;
                case "MonoPrefix":
                    MonoPrefix = iter.Current.Value;
                    break;
                case "MonoPath":
                    MonoPath = iter.Current.Value;
                    break;
                default:
                    throw new InternalError ();
                }
            }

            if (inferior_args == null)
                inferior_args = new string [0];
        }
开发者ID:baulig,项目名称:debugger,代码行数:30,代码来源:DebuggerOptions.cs

示例2: difference2

        /// <summary>
        /// Implements an optimized algorithm for the following function 
        ///    node-set difference(node-set, node-set) 
        /// Uses document identification and binary search,
        /// based on the fact that a node-set is always in document order.
        /// </summary>
        /// <param name="nodeset1">An input nodeset</param>
        /// <param name="nodeset2">Another input nodeset</param>
        /// <returns>The those nodes that are in the node set 
        /// passed as the first argument that are not in the node set 
        /// passed as the second argument.</returns>
        /// <author>Dimitre Novatchev</author>
		
        private XPathNodeIterator difference2(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
        {
            ArrayList arDocs = new ArrayList();

            ArrayList arNodes2 = new ArrayList(nodeset2.Count);

            while(nodeset2.MoveNext())
            {
                arNodes2.Add(nodeset2.Current.Clone());
            }


            auxEXSLT.findDocs(arNodes2, arDocs);

            ExsltNodeList enlResult = new ExsltNodeList();

            while(nodeset1.MoveNext())
            {
                XPathNavigator currNode = nodeset1.Current; 
				
                if(!auxEXSLT.findNode(arNodes2, arDocs, currNode) )
                    enlResult.Add(currNode.Clone());
            }

            return ExsltCommon.ExsltNodeListToXPathNodeIterator(enlResult); 
        }
开发者ID:zanyants,项目名称:mvp.xml,代码行数:39,代码来源:ExsltSets.cs

示例3: Evaluate

 public override object Evaluate(XPathNodeIterator nodeIterator)
 {
     return GetValue(_op,
         XmlConvertEx.ToXPathDouble(_opnd1.Evaluate(nodeIterator)),
         XmlConvertEx.ToXPathDouble(_opnd2.Evaluate(nodeIterator))
     );
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:NumericExpr.cs

示例4: Evaluate

 public override object Evaluate(XPathNodeIterator context)
 {
     outputBuffer.Clear();
     count = 0;
     return input.Evaluate(context);// This is trick. IDQuery needs this value. Otherwise we would return this.
                                    // All subclasses should and would anyway override thismethod and return this.
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:CacheOutputQuery.cs

示例5: Evaluate

 public override object Evaluate(XPathNodeIterator context)
 {
     base.contextNode = context.Current.Clone();
     base.contextNode.MoveToRoot();
     base.count = 0;
     return this;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:AbsoluteQuery.cs

示例6: Evaluate

        public override object Evaluate(XPathNodeIterator nodeIterator)
        {
            if (xsltContext == null)
            {
                throw XPathException.Create(SR.Xp_NoContext);
            }

            // calculate arguments:
            object[] argVals = new object[_args.Count];
            for (int i = 0; i < _args.Count; i++)
            {
                argVals[i] = _args[i].Evaluate(nodeIterator);
                if (argVals[i] is XPathNodeIterator)
                {// ForBack Compat. To protect our queries from users.
                    argVals[i] = new XPathSelectionIterator(nodeIterator.Current, _args[i]);
                }
            }
            try
            {
                return ProcessResult(_function.Invoke(xsltContext, argVals, nodeIterator.Current));
            }
            catch (Exception ex)
            {
                throw XPathException.Create(SR.Xp_FunctionFailed, QName, ex);
            }
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:26,代码来源:FunctionQuery.cs

示例7: FilterNodes

        public static XPathNodeIterator FilterNodes(XPathNodeIterator nodeset, string xpath)
        {
            try
            {
                while (nodeset.MoveNext())
                {
                    var nav = nodeset.Current;
                    var manager = new XmlNamespaceManager(nav.NameTable);

                    nav.MoveToFollowing(XPathNodeType.Element);

                    foreach (var ns in nav.GetNamespacesInScope(XmlNamespaceScope.All))
                    {
                        manager.AddNamespace(ns.Key, ns.Value);
                    }

                    var result = nav.Evaluate(xpath, manager);
                    if (result is XPathNodeIterator) {
                        return (XPathNodeIterator)result;
                    } else {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml("<result expression=\"" + xpath + "\">" + result.ToString() + "</result>");
                        return (XPathNodeIterator)doc.DocumentElement.CreateNavigator().Evaluate("/result");
                    }
                }
            }
            catch (Exception ex)
            {
                return ex.ToXPathNodeIterator();
            }

            return nodeset;
        }
开发者ID:greystate,项目名称:xpathfiddle,代码行数:33,代码来源:XsltExtensions.cs

示例8: Evaluate

 public override object Evaluate(XPathNodeIterator context)
 {
     base.Evaluate(context);
     List<XPathNavigator> parentStk = new List<XPathNavigator>();
     Stack<XPathNavigator> stack = new Stack<XPathNavigator>();
     while ((base.currentNode = base.qyInput.Advance()) != null)
     {
         stack.Push(base.currentNode.Clone());
     }
     while (stack.Count != 0)
     {
         XPathNavigator nav = stack.Pop();
         if (((nav.NodeType != XPathNodeType.Attribute) && (nav.NodeType != XPathNodeType.Namespace)) && this.NotVisited(nav, parentStk))
         {
             XPathNavigator e = nav.Clone();
             if (e.MoveToParent())
             {
                 e.MoveToFirstChild();
                 while (!e.IsSamePosition(nav))
                 {
                     if (this.matches(e))
                     {
                         base.Insert(base.outputBuffer, e);
                     }
                     if (e.MoveToNext())
                     {
                     }
                 }
             }
         }
     }
     return this;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:PreSiblingQuery.cs

示例9: avg

		/// <summary>
		/// Implements the following function 
		///    number avg(node-set)
		/// </summary>
		/// <param name="iterator"></param>
		/// <returns>The average of all the value of all the nodes in the 
		/// node set</returns>
		/// <remarks>THIS FUNCTION IS NOT PART OF EXSLT!!!</remarks>
		public double avg(XPathNodeIterator iterator)
		{

			double sum = 0;
			int count = iterator.Count;

			if (count == 0)
			{
				return Double.NaN;
			}

			try
			{
				while (iterator.MoveNext())
				{
					sum += XmlConvert.ToDouble(iterator.Current.Value);
				}

			}
			catch (FormatException)
			{
				return Double.NaN;
			}

			return sum / count;
		}
开发者ID:kisflying,项目名称:kion,代码行数:34,代码来源:GDNMath.cs

示例10: Read

        public List<TSK> Read(XPathNodeIterator iterator)
        {
            var tsks = new List<TSK>();
            if (iterator.Count == 0)
                return tsks;

            foreach (XPathNavigator node in iterator)
            {
                if (node.SelectChildren("TLG", node.NamespaceURI).Count == 0)
                    continue;

                var tsk = new TSK
                {
                    A = GetStringValue(node, "A"),
                    B = GetStringValue(node, "B"),
                    C = GetStringValue(node, "C"),
                    D = GetStringValue(node, "D"),
                    E = GetStringValue(node, "E"),
                    F = GetStringValue(node, "F"),
                    G = GetEnumValue(node, "G"),
                    H = GetByteValue(node, "H"),
                    I = GetByteValue(node, "I"),
                    J = GetByteValue(node, "J"),
                    Items = GetItems(node),
                };

                tsks.Add(tsk);
            }

            return tsks;
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:31,代码来源:TsksReader.cs

示例11: highest

		/// <summary>
		/// Implements the following function 
		///    node-set highest(node-set)
		/// </summary>
		/// <param name="iterator">The input nodeset</param>
		/// <returns>All the nodes that contain the max value in the nodeset</returns>		
		public static XPathNodeIterator highest(XPathNodeIterator iterator){

			ExsltNodeList newList = new ExsltNodeList(); 
			double max, t; 

			if(iterator.Count == 0){
				return ExsltCommon.ExsltNodeListToXPathNodeIterator(newList);  
			}


			try{ 

				iterator.MoveNext(); 
				max = XmlConvert.ToDouble(iterator.Current.Value);
				newList.Add(iterator.Current.Clone()); 

				while (iterator.MoveNext()){
					t = XmlConvert.ToDouble(iterator.Current.Value);
				
					if(t > max){
						max =  t;
						newList.Clear(); 
						newList.Add(iterator.Current.Clone()); 
					}else if( t == max){
						newList.Add(iterator.Current.Clone()); 
					}
				}
				
			}catch(Exception){ //return empty node set
				newList.Clear(); 
				return ExsltCommon.ExsltNodeListToXPathNodeIterator(newList);  
			}

			return ExsltCommon.ExsltNodeListToXPathNodeIterator(newList); 
		}
开发者ID:elrute,项目名称:Triphulcas,代码行数:41,代码来源:ExsltMath.cs

示例12: Evaluate

        public override object Evaluate(XPathNodeIterator context)
        {
            object obj2 = base.Evaluate(context);
            XPathNavigator contextNode = context.Current.Clone();
            switch (base.GetXPathType(obj2))
            {
                case XPathResultType.Number:
                    this.ProcessIds(contextNode, StringFunctions.toString((double) obj2));
                    break;

                case XPathResultType.String:
                    this.ProcessIds(contextNode, (string) obj2);
                    break;

                case XPathResultType.Boolean:
                    this.ProcessIds(contextNode, StringFunctions.toString((bool) obj2));
                    break;

                case XPathResultType.NodeSet:
                    XPathNavigator navigator2;
                    while ((navigator2 = base.input.Advance()) != null)
                    {
                        this.ProcessIds(contextNode, navigator2.Value);
                    }
                    break;

                case ((XPathResultType) 4):
                    this.ProcessIds(contextNode, ((XPathNavigator) obj2).Value);
                    break;
            }
            return this;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:IDQuery.cs

示例13: XPathResult

 internal XPathResult(XPathNodeIterator nodeSetResult)
     : this()
 {
     this.nodeSetResult = nodeSetResult;
     this.internalIterator = nodeSetResult as SafeNodeSequenceIterator;
     this.resultType = XPathResultType.NodeSet;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:XPathResult.cs

示例14: min

		/// <summary>
		/// Implements the following function 
		///    string date2:min(node-set)
		/// See http://www.xmland.net/exslt/doc/GDNDatesAndTimes-min.xml
		/// </summary>        
		/// <remarks>THIS FUNCTION IS NOT PART OF EXSLT!!!</remarks>
		public string min(XPathNodeIterator iterator)
		{

			TimeSpan min, t;

			if (iterator.Count == 0)
			{
				return "";
			}

			try
			{

				iterator.MoveNext();
				min = XmlConvert.ToTimeSpan(iterator.Current.Value);

				while (iterator.MoveNext())
				{
					t = XmlConvert.ToTimeSpan(iterator.Current.Value);
					min = (t < min) ? t : min;
				}

			}
			catch (FormatException)
			{
				return "";
			}

			return XmlConvert.ToString(min);
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:36,代码来源:GDNDatesAndTimes.cs

示例15: min

		/// <summary>
		/// Implements the following function 
		///    number min(node-set)
		/// </summary>
		/// <param name="iterator"></param>
		/// <returns></returns>        
		public double min(XPathNodeIterator iterator)
		{
			double min, t;

			if (iterator.Count == 0)
			{
				return Double.NaN;
			}

			try
			{

				iterator.MoveNext();
				min = XmlConvert.ToDouble(iterator.Current.Value);


				while (iterator.MoveNext())
				{
					t = XmlConvert.ToDouble(iterator.Current.Value);
					min = (t < min) ? t : min;
				}

			}
			catch
			{
				return Double.NaN;
			}

			return min;
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:36,代码来源:ExsltMath.cs


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