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


C# XPathNavigator.SelectDescendants方法代码示例

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


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

示例1: GetItems

        private IWriter[] GetItems(XPathNavigator node)
        {
            var dlvs = node.SelectDescendants("DLV", node.NamespaceURI, true);
            var mappedDlvs = _dlvReader.Read(dlvs);

            return mappedDlvs.ToArray();
        }
开发者ID:ADAPT,项目名称:ISOv4Plugin,代码行数:7,代码来源:TaskdataTimReader.cs

示例2: LoadBook

 private void LoadBook(XPathNavigator lstNav)
 {
     //We are passsed an XPathNavigator of a particular book node
       //we will select all of the direct descendents and
       //load the list box with the names and values
       XPathNodeIterator iterBook=lstNav.SelectDescendants(XPathNodeType.Element,false);
       while(iterBook.MoveNext())
     listBox1.Items.Add(iterBook.Current.Name + ": " + iterBook.Current.Value);
 }
开发者ID:alannet,项目名称:example,代码行数:9,代码来源:XPathXSLSample2.cs

示例3: BuildKeyTable

        private Hashtable BuildKeyTable(Key key, XPathNavigator root) {
            Hashtable keyTable = new Hashtable();

            string matchStr = this.processor.GetQueryExpression(key.MatchKey);
            Query matchExpr = this.processor.GetCompiledQuery(key.MatchKey);
            Query useExpr   = this.processor.GetCompiledQuery(key.UseKey);

            XPathNodeIterator  sel = root.SelectDescendants(XPathNodeType.All, /*matchSelf:*/ false);

            while(sel.MoveNext()) {
                XPathNavigator node = sel.Current;
                EvaluateKey(node, matchExpr, matchStr, useExpr, keyTable);
                if (node.MoveToFirstAttribute()) {
                    do {
                        EvaluateKey(node, matchExpr, matchStr, useExpr, keyTable);
                    } while (node.MoveToNextAttribute());
                    node.MoveToParent();
                }
            }
            return keyTable;
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:21,代码来源:XsltCompileContext.cs

示例4: advance

        internal override XPathNavigator advance()
        {
            if (proceed) {
                if (temp == null )
                {
                        XPathNavigator _eLast = m_qyInput.advance();    
                        while (_eLast != null){
                            temp = _eLast.Clone();
                            _eLast = m_qyInput.advance();
                        }
                        if (temp == null || temp.NodeType == XPathNodeType.Root) 
                            return null;
                        if (temp.NodeType == XPathNodeType.Attribute || temp.NodeType == XPathNodeType.Namespace){
                            temp.MoveToParent();
                        }
                        NotVisited(temp.Clone());
                        _AncestorStk.Add(temp.Clone());
                        temp.MoveToRoot();
                        _qy = temp.SelectDescendants(XPathNodeType.All, false);
                } 
                int flag;
                while ( _qy.MoveNext())
                {
                    m_eNext = _qy.Current;
                    if (matches(m_eNext)){
                        flag = InStk(m_eNext);
                        if (flag == 1){
                            _position++;
                            return m_eNext;
                        }
                        if (flag == 2) {
                            proceed = false;
                            m_eNext = null;
                            return null;
                        }
                    }
                    else{
                        if (m_eNext.IsSamePosition((XPathNavigator)_AncestorStk[_AncestorStk.Count -1])) {
                            proceed = false;
                            m_eNext = null;
                            return null;
                        }
                    }
                }
                return null;

            }
            return null;

        }
开发者ID:ArildF,项目名称:masters,代码行数:50,代码来源:precedingquery.cs

示例5: FixCodeNodes

	/* doesn't work because can't modify node via XPathNavigator
				/// <summary>
				/// Fix code nodes such that it will be rendered correctly (using pre).
				/// </summary>
				/// <param name="topNode"></param>
				private void FixCodeNodes(XPathNavigator nav)
				{
					XPathNodeIterator iter = nav.SelectDescendants("code", string.Empty, true);
					while(iter.MoveNext())
					{
						XPathNavigator n = iter.Current;
						n.Value = "<pre class=\"code\">" + n.Value + "</pre>";
					}
				}
		*/

		/// <summary>
		/// Return a new XPathNavigator pointing to the first descendant node
		/// with the specified name.
		/// </summary>
		/// <param name="nodeName">The node name string.</param>
		/// <param name="startNavigator">Initial node to start search from.</param>
		/// <returns>An XPathNavigator pointing to the specified descendant, or null
		/// for not found.</returns>
		XPathNavigator GetDescendantNodeWithName(XPathNavigator startNavigator, string nodeName)
		{
			XPathNodeIterator xni = startNavigator.SelectDescendants(nodeName, "", false);
			xni.MoveNext();
			if (xni.Current.ComparePosition(startNavigator) == XmlNodeOrder.Same)
				return(null);
			else return(xni.Current);
		}
开发者ID:palfrey,项目名称:ndoc,代码行数:32,代码来源:LinearHtmlDocumenter.cs

示例6: GetDescendants

		/// <summary>
		/// Get the descendants of the current node which have the specified
		/// localName.  This just provides a different iteration style
		/// from XPathNavigator.SelectDescendants().
		/// </summary>
		/// <param name="localName">The localname to select.</param>
		/// <param name="nav">The XPathNavigator.</param>
		/// <returns>A new ArrayList of XPathNavigators.</returns>
		ArrayList GetDescendants(XPathNavigator nav, string localName)
		{
			ArrayList list = new ArrayList();

			XPathNodeIterator iter = nav.SelectDescendants(localName, "", false);
			while(iter.MoveNext())
			{
				list.Add(iter.Current.Clone());
			}

			return(list);
		}
开发者ID:palfrey,项目名称:ndoc,代码行数:20,代码来源:LinearHtmlDocumenter.cs

示例7: FindChildElement

        private XPathNavigator FindChildElement(XPathNavigator navigator, IDictionary searchKeys)
        {
            XPathNodeIterator nodes =
                navigator.SelectDescendants(XPathNodeType.Element, false);

            foreach (XPathNavigator node in nodes)
            {
                if (node.HasAttributes == false) continue;  // skip empty ones

                Hashtable attributes = new Hashtable();  // attribute list

                XPathNavigator attrNavigator = node.Clone();
                bool flagMoreAttributes = attrNavigator.MoveToFirstAttribute();
                while (flagMoreAttributes)
                {
                    attributes.Add(attrNavigator.Name, attrNavigator.Value);
                    flagMoreAttributes = attrNavigator.MoveToNextAttribute();
                }

                bool foundit = true;
                foreach (Object searchKeyObj in searchKeys)
                {
                    DictionaryEntry searchEntry = (DictionaryEntry)searchKeyObj;
                    string searchKey   = searchEntry.Key.ToString();
                    string searchValue = searchEntry.Value.ToString();

                    // Match search keys against the child's attributes
                    if (attributes.ContainsKey(searchKey) &&
                        attributes[searchKey].ToString() == searchValue)
                            continue;  // so far so good.  matching so far
                    foundit = false;  // no match
                    break;
                }

                if (foundit)
                    return node;  // return the navigator to found child
            }  // foreach through the element children, still looking
            return null;  // child element not found using the keys
        }
开发者ID:JordanChin,项目名称:Ingres,代码行数:39,代码来源:vsinstaller.cs

示例8: GetTaskDifficultyTag

        public int GetTaskDifficultyTag(XPathNavigator rtmCompletedTasksIterator)
        {
            // Purpose: Return 0, 1, or 2, equal to the task's difficulty tag "d1" "d2" or "d3". If the task has no "d#" tag, default to "d1".

            int DifficultyLevel = 0;
            XPathNodeIterator TagIterator = rtmCompletedTasksIterator.SelectDescendants("tag", "", false);

            while (TagIterator.MoveNext())                                                                          // Search through any <Tag> elements. If multiple "d#" tags are present, return the highest value.
            {
                switch (TagIterator.Current.Value.ToString())
                {
                    case "d2":
                        {
                            if (DifficultyLevel == 0)
                            {
                                DifficultyLevel = 1;
                            }

                            break;
                        }
                    case "d3":
                        {
                            DifficultyLevel = 2;
                            break;
                        }
                }
            }

            return DifficultyLevel;
        }
开发者ID:jroussin007,项目名称:hrpg-rtm-sync,代码行数:30,代码来源:Form1.cs


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