/// <summary>
/// Implements an optimized algorithm for the following function
/// node-set difference(node-set, node-set)
/// Uses document identification and binary search,
/// based on the fact that a node-set is always in document order.
/// </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>
/// <author>Dimitre Novatchev</author>
private XPathNodeIterator difference2(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2)
{
List<Pair> arDocs = new List<Pair>();
List<XPathNavigator> arNodes2 = new List<XPathNavigator>(nodeset2.Count);
while (nodeset2.MoveNext())
{
arNodes2.Add(nodeset2.Current.Clone());
}
auxEXSLT.findDocs(arNodes2, arDocs);
XPathNavigatorIterator enlResult = new XPathNavigatorIterator();
while (nodeset1.MoveNext())
{
XPathNavigator currNode = nodeset1.Current;
if (!auxEXSLT.findNode(arNodes2, arDocs, currNode))
enlResult.Add(currNode.Clone());
}
enlResult.Reset();
return enlResult;
}