本文整理汇总了C#中Mono.Xml.XPath2.XPathSequence.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# XPathSequence.Clone方法的具体用法?C# XPathSequence.Clone怎么用?C# XPathSequence.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Xml.XPath2.XPathSequence
的用法示例。
在下文中一共展示了XPathSequence.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FnOneOrMore
public static object FnOneOrMore (XPathSequence e)
{
if (!e.Clone ().MoveNext ())
throw new XmlQueryException ("one-or-more() function detected that the argument sequence contains no items.");
return e;
}
示例2: Evaluate
public override XPathSequence Evaluate (XPathSequence iter)
{
XQueryContext ctx = iter.Context;
if (iter.Position == 0) {
iter = iter.Clone ();
if (!iter.MoveNext ())
return new XPathEmptySequence (iter.Context);
}
XPathNavigator nav = iter.Current as XPathNavigator;
if (nav == null)
throw new XmlQueryException ("Node set is expected.");
NodeIterator argIter = null;
switch (Axis.AxisType) {
case XPathAxisType.Child:
argIter = new ChildIterator (nav, ctx); break;
case XPathAxisType.Descendant:
argIter = new DescendantIterator (nav, ctx); break;
case XPathAxisType.Attribute:
argIter = new AttributeIterator (nav, ctx); break;
case XPathAxisType.Self:
argIter = new SelfIterator (nav, ctx); break;
case XPathAxisType.DescendantOrSelf:
argIter = new DescendantOrSelfIterator (nav, ctx); break;
case XPathAxisType.FollowingSibling:
argIter = new FollowingSiblingIterator (nav, ctx); break;
case XPathAxisType.Following:
argIter = new FollowingIterator (nav, ctx); break;
case XPathAxisType.Parent:
argIter = new ParentIterator (nav, ctx); break;
case XPathAxisType.Ancestor:
argIter = new AncestorIterator (nav, ctx); break;
case XPathAxisType.PrecedingSibling:
argIter = new PrecedingSiblingIterator (nav, ctx); break;
case XPathAxisType.Preceding:
argIter = new PrecedingIterator (nav, ctx); break;
case XPathAxisType.AncestorOrSelf:
argIter = new AncestorOrSelfIterator (nav, ctx); break;
case XPathAxisType.Namespace: // only applicable under XPath 2.0: not XQuery 1.0
argIter = new NamespaceIterator (nav, ctx); break;
}
return new AxisIterator (argIter, this);
}