System.Xml.XPath.XPathNavigator.SelectAncestors C# (CSharp) Method

SelectAncestors() public method

public SelectAncestors ( XPathNodeType type, bool matchSelf ) : XPathNodeIterator
type XPathNodeType
matchSelf bool
return XPathNodeIterator
        public virtual XPathNodeIterator SelectAncestors(XPathNodeType type, bool matchSelf)
        {
            return new XPathAncestorIterator(this.Clone(), type, matchSelf);
        }

Same methods

XPathNavigator::SelectAncestors ( string name, string namespaceURI, bool matchSelf ) : XPathNodeIterator

Usage Example

 private void AddSchemaElement(XPathNavigator nav, XPathNavigator rootNav)
 {
     List<string> list = new List<string>();
     XPathNodeIterator iterator = nav.SelectAncestors(XPathNodeType.Element, true);
     while (iterator.MoveNext())
     {
         list.Add(iterator.Current.Name);
         if (iterator.Current.IsSamePosition(rootNav))
         {
             break;
         }
     }
     list.Reverse();
     OrderedDictionary first = this._rootSchema;
     Pair pair = null;
     foreach (string str in list)
     {
         pair = first[str] as Pair;
         if (pair == null)
         {
             pair = new Pair(new OrderedDictionary(), new ArrayList());
             first.Add(str, pair);
         }
         first = (OrderedDictionary) pair.First;
     }
     this.AddAttributeList(nav, (ArrayList) pair.Second);
 }
All Usage Examples Of System.Xml.XPath.XPathNavigator::SelectAncestors