Mvp.Xml.Common.XPath.XPathNavigatorIterator.Contains C# (CSharp) Méthode

Contains() public méthode

Determines whether the list contains a navigator positioned at the same location as the specified XPathNavigator. This method relies on the IsSamePositon() method of the XPathNavightor.
public Contains ( XPathNavigator value ) : bool
value System.Xml.XPath.XPathNavigator The object to locate in the list.
Résultat bool
        public bool Contains(XPathNavigator value)
        {
            foreach (XPathNavigator nav in _navigators)
            {
                if (nav.IsSamePosition(value))
                {
                    return true;
                }
            }
            return false;
        }

Usage Example

Exemple #1
0
		/// <summary>
		/// Implements the following function 
		///    boolean subset(node-set, node-set) 
		/// </summary>
		/// <param name="nodeset1">An input nodeset</param>
		/// <param name="nodeset2">Another input nodeset</param>
		/// <returns>True if all the nodes in the first nodeset are contained 
		/// in the second nodeset</returns>
		/// <remarks>THIS FUNCTION IS NOT PART OF EXSLT!!!</remarks>
		public bool subset(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
		{
			if (nodeset1.Count > 125 || nodeset2.Count > 125)
				return subset2(nodeset1, nodeset2);
			//else
			XPathNavigatorIterator nodelist1 = new XPathNavigatorIterator(nodeset1, true);
			XPathNavigatorIterator nodelist2 = new XPathNavigatorIterator(nodeset2, true);

			foreach (XPathNavigator nav in nodelist1)
			{
				if (!nodelist2.Contains(nav))
				{
					return false;
				}
			}
			return true;
		}
All Usage Examples Of Mvp.Xml.Common.XPath.XPathNavigatorIterator::Contains