本文整理匯總了C#中System.Xml.XPath.BaseIterator.Clone方法的典型用法代碼示例。如果您正苦於以下問題:C# BaseIterator.Clone方法的具體用法?C# BaseIterator.Clone怎麽用?C# BaseIterator.Clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.XPath.BaseIterator
的用法示例。
在下文中一共展示了BaseIterator.Clone方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Evaluate
// Invoked from XsltKey (XPathFunction)
public BaseIterator Evaluate (BaseIterator iter,
Expression valueExpr)
{
XPathNodeIterator i = iter;
if (iter.CurrentPosition == 0) {
i = iter.Clone ();
i.MoveNext ();
}
XPathNavigator nav = i.Current;
object o = valueExpr.Evaluate (iter);
XPathNodeIterator it = o as XPathNodeIterator;
XsltContext ctx = iter.NamespaceManager as XsltContext;
BaseIterator result = null;
if (it != null) {
while (it.MoveNext()) {
ArrayList nodes = GetNodesByValue (
nav, it.Current.Value, ctx);
if (nodes == null)
continue;
ListIterator tmp =
new ListIterator (nodes, ctx);
if (result == null)
result = tmp;
else
result = new UnionIterator (
iter, result, tmp);
}
}
else if (nav != null) {
ArrayList nodes = GetNodesByValue (
nav, XPathFunctions.ToString (o), ctx);
if (nodes != null)
result = new ListIterator (nodes, ctx);
}
return result != null ? result : new NullIterator (iter);
}
示例2: Evaluate
public override object Evaluate (BaseIterator iter)
{
if (iter.CurrentPosition == 0) {
iter = (BaseIterator) iter.Clone ();
iter.MoveNext ();
}
XPathNavigator navRoot = iter.Current.Clone ();
navRoot.MoveToRoot ();
return new SelfIterator (navRoot, iter.NamespaceManager);
}