當前位置: 首頁>>代碼示例>>C#>>正文


C# XPathNavigator.MoveToNonDescendant方法代碼示例

本文整理匯總了C#中System.Xml.XPath.XPathNavigator.MoveToNonDescendant方法的典型用法代碼示例。如果您正苦於以下問題:C# XPathNavigator.MoveToNonDescendant方法的具體用法?C# XPathNavigator.MoveToNonDescendant怎麽用?C# XPathNavigator.MoveToNonDescendant使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.XPath.XPathNavigator的用法示例。


在下文中一共展示了XPathNavigator.MoveToNonDescendant方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MoveFirst

        /// <summary>
        /// Position "nav" to the matching node which follows it in document order but is not a descendant node.
        /// Return false if this is no such matching node.
        /// </summary>
        internal static bool MoveFirst(XmlNavigatorFilter filter, XPathNavigator nav) {
            // Attributes and namespace nodes include descendants of their owner element in the set of following nodes
            if (nav.NodeType == XPathNodeType.Attribute || nav.NodeType == XPathNodeType.Namespace) {
                if (!nav.MoveToParent()) {
                    // Floating attribute or namespace node that has no following nodes
                    return false;
                }

                if (!filter.MoveToFollowing(nav, null)) {
                    // No matching following nodes
                    return false;
                }
            }
            else {
                // XPath spec doesn't include descendants of the input node in the following axis
                if (!nav.MoveToNonDescendant())
                    // No following nodes
                    return false;

                // If the sibling does not match the node-test, find the next following node that does
                if (filter.IsFiltered(nav)) {
                    if (!filter.MoveToFollowing(nav, null)) {
                        // No matching following nodes
                        return false;
                    }
                }
            }

            // Success
            return true;
        }
開發者ID:gbarnett,項目名稱:shared-source-cli-2.0,代碼行數:35,代碼來源:treeiterators.cs

示例2: MoveToFollowing

 public virtual bool MoveToFollowing(XPathNodeType type, XPathNavigator end)
 {
     XPathNavigator other = this.Clone();
     int contentKindMask = GetContentKindMask(type);
     if (end != null)
     {
         switch (end.NodeType)
         {
             case XPathNodeType.Attribute:
             case XPathNodeType.Namespace:
                 end = end.Clone();
                 end.MoveToNonDescendant();
                 break;
         }
     }
     switch (this.NodeType)
     {
         case XPathNodeType.Attribute:
         case XPathNodeType.Namespace:
             if (this.MoveToParent())
             {
                 break;
             }
             return false;
     }
 Label_005C:
     if (!this.MoveToFirstChild())
     {
         do
         {
             if (this.MoveToNext())
             {
                 goto Label_007E;
             }
         }
         while (this.MoveToParent());
         this.MoveTo(other);
         return false;
     }
 Label_007E:
     if ((end != null) && this.IsSamePosition(end))
     {
         this.MoveTo(other);
         return false;
     }
     if (((((int) 1) << this.NodeType) & contentKindMask) == 0)
     {
         goto Label_005C;
     }
     return true;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:51,代碼來源:XPathNavigator.cs

示例3: MoveToFollowing

        public virtual bool MoveToFollowing(XPathNodeType type, XPathNavigator end)
        {
            XPathNavigator navSave = Clone();
            int mask = XPathNavigatorEx.GetContentKindMask(type);

            if (end != null)
            {
                switch (end.NodeType)
                {
                    case XPathNodeType.Attribute:
                    case XPathNodeType.Namespace:
                        // Scan until we come to the next content-typed node 
                        // after the attribute or namespace node
                        end = end.Clone();
                        end.MoveToNonDescendant();
                        break;
                }
            }
            switch (NodeType)
            {
                case XPathNodeType.Attribute:
                case XPathNodeType.Namespace:
                    if (!MoveToParent())
                    {
                        return false;
                    }
                    break;
            }
            do
            {
                if (!MoveToFirstChild())
                {
                    // Look for next sibling
                    while (true)
                    {
                        if (MoveToNext())
                            break;

                        if (!MoveToParent())
                        {
                            // Restore previous position and return false
                            MoveTo(navSave);
                            return false;
                        }
                    }
                }

                // Have we reached the end of the scan?
                if (end != null && IsSamePosition(end))
                {
                    // Restore previous position and return false
                    MoveTo(navSave);
                    return false;
                }
            }
            while (((1 << (int)NodeType) & mask) == 0);

            return true;
        }
開發者ID:noahfalk,項目名稱:corefx,代碼行數:59,代碼來源:XPathNavigator.cs


注:本文中的System.Xml.XPath.XPathNavigator.MoveToNonDescendant方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。