예제 #1
0
        /// <summary>
        /// Implements the following function 
        ///    node-set difference(node-set, node-set) 
        /// </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>
        public XPathNodeIterator difference(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
        {
            if(nodeset2.Count > 166)
                return difference2(nodeset1, nodeset2);
            //else
            ExsltNodeList nodelist1 = new ExsltNodeList(nodeset1, true);
            ExsltNodeList nodelist2 = new ExsltNodeList(nodeset2);
 
					 
            for(int i = 0; i < nodelist1.Count; i++)
            { 
						
                XPathNavigator nav = nodelist1[i]; 
					
                if(nodelist2.Contains(nav))
                {
                    nodelist1.RemoveAt(i); 
                    i--; 
                }
            } 

            return ExsltCommon.ExsltNodeListToXPathNodeIterator(nodelist1); 
        }
예제 #2
0
        /// <summary>
        /// Implements the following function
        ///    node-set difference(node-set, node-set)
        /// </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>
        public XPathNodeIterator difference(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
        {
            if (nodeset2.Count > 166)
            {
                return(difference2(nodeset1, nodeset2));
            }
            //else
            ExsltNodeList nodelist1 = new ExsltNodeList(nodeset1, true);
            ExsltNodeList nodelist2 = new ExsltNodeList(nodeset2);


            for (int i = 0; i < nodelist1.Count; i++)
            {
                XPathNavigator nav = nodelist1[i];

                if (nodelist2.Contains(nav))
                {
                    nodelist1.RemoveAt(i);
                    i--;
                }
            }

            return(ExsltCommon.ExsltNodeListToXPathNodeIterator(nodelist1));
        }
예제 #3
0
        /// <summary>
        /// Implements the following function
        ///   node-set intersection(node-set, node-set)
        /// </summary>
        /// <param name="nodeset1">The first node-set</param>
        /// <param name="nodeset2">The second node-set</param>
        /// <returns>The node-set, which is the intersection
        ///          of nodeset1 and nodeset2
        /// </returns>
        public XPathNodeIterator intersection(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
        {
            if (nodeset1.Count >= 500 || nodeset2.Count >= 500)
            {
                return(intersection3(nodeset1, nodeset2));
            }
            //else
            ExsltNodeList nodelist1 = new ExsltNodeList(nodeset1, true);
            ExsltNodeList nodelist2 = new ExsltNodeList(nodeset2);


            for (int i = 0; i < nodelist1.Count; i++)
            {
                XPathNavigator nav = nodelist1[i];

                if (!nodelist2.Contains(nav))
                {
                    nodelist1.RemoveAt(i);
                    i--;
                }
            }

            return(ExsltCommon.ExsltNodeListToXPathNodeIterator(nodelist1));
        }
예제 #4
0
        /// <summary>
        /// Implements the following function 
        ///   node-set intersection(node-set, node-set)
        /// </summary>
        /// <param name="nodeset1">The first node-set</param>
        /// <param name="nodeset2">The second node-set</param>
        /// <returns>The node-set, which is the intersection
        ///          of nodeset1 and nodeset2
        /// </returns>
        public XPathNodeIterator intersection(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
        {
				
            if(nodeset1.Count >= 500 || nodeset2.Count >= 500)
                return intersection3(nodeset1, nodeset2);
            //else
            ExsltNodeList nodelist1 = new ExsltNodeList(nodeset1, true);
            ExsltNodeList nodelist2 = new ExsltNodeList(nodeset2);
 
					 
            for(int i = 0; i < nodelist1.Count; i++)
            { 
						
                XPathNavigator nav = nodelist1[i]; 
					
                if(!nodelist2.Contains(nav))
                {
                    nodelist1.RemoveAt(i); 
                    i--; 
                }
            } 

            return ExsltCommon.ExsltNodeListToXPathNodeIterator(nodelist1); 

        }