Пример #1
0
        public XPathNodeIterator Difference2(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
        {
            var arDocs = new List <Pair>();

            var arNodes2 = new List <XPathNavigator>(nodeset2.Count);

            while (nodeset2.MoveNext())
            {
                arNodes2.Add(nodeset2.Current.Clone());
            }

            AuxExslt.FindDocs(arNodes2, arDocs);

            var enlResult = new XPathNavigatorIterator();

            while (nodeset1.MoveNext())
            {
                var currNode = nodeset1.Current;

                if (!AuxExslt.FindNode(arNodes2, arDocs, currNode))
                {
                    enlResult.Add(currNode.Clone());
                }
            }

            enlResult.Reset();
            return(enlResult);
        }
Пример #2
0
        public bool HasSameNode2(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
        {
            var it1 =
                (nodeset1.Count > nodeset2.Count)
                                        ? nodeset1
                                        : nodeset2;

            var it2 =
                (nodeset1.Count > nodeset2.Count)
                                        ? nodeset2
                                        : nodeset1;

            var arDocs = new List <Pair>();

            var arNodes1 = new List <XPathNavigator>(it1.Count);

            while (it1.MoveNext())
            {
                arNodes1.Add(it1.Current.Clone());
            }

            AuxExslt.FindDocs(arNodes1, arDocs);

            while (it2.MoveNext())
            {
                var currNode = it2.Current;

                if (AuxExslt.FindNode(arNodes1, arDocs, currNode))
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #3
0
        public bool Subset2(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
        {
            var arDocs = new List <Pair>();

            var arNodes2 = new List <XPathNavigator>(nodeset2.Count);

            while (nodeset2.MoveNext())
            {
                arNodes2.Add(nodeset2.Current.Clone());
            }

            AuxExslt.FindDocs(arNodes2, arDocs);

            while (nodeset1.MoveNext())
            {
                var currNode = nodeset1.Current;

                if (!AuxExslt.FindNode(arNodes2, arDocs, currNode))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #4
0
        private static XPathNodeIterator Intersection3(XPathNodeIterator nodeset1,
                                                       XPathNodeIterator nodeset2)
        {
            var it1 =
                (nodeset1.Count > nodeset2.Count)
                                        ? nodeset1
                                        : nodeset2;

            var it2 =
                (nodeset1.Count > nodeset2.Count)
                                        ? nodeset2
                                        : nodeset1;

            var arDocs = new List <Pair>();

            var arNodes1 = new List <XPathNavigator>(it1.Count);

            while (it1.MoveNext())
            {
                arNodes1.Add(it1.Current.Clone());
            }

            AuxExslt.FindDocs(arNodes1, arDocs);

            var enlResult = new XPathNavigatorIterator();

            while (it2.MoveNext())
            {
                var currNode = it2.Current;

                if (AuxExslt.FindNode(arNodes1, arDocs, currNode))
                {
                    enlResult.Add(currNode.Clone());
                }
            }

            enlResult.Reset();
            return(enlResult);
        }