本文整理汇总了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);
}