1 //------------------------------------------------------------------------------
2 // <copyright file="XmlIterators.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // <owner current="true" primary="true">Microsoft</owner>
6 //------------------------------------------------------------------------------
9 using System.Xml.XPath;
10 using System.ComponentModel;
12 namespace System.Xml.Xsl.Runtime {
15 /// Iterators that use containment to control a nested iterator return one of the following values from MoveNext().
17 [EditorBrowsable(EditorBrowsableState.Never)]
18 public enum IteratorResult {
19 NoMoreNodes, // Iteration is complete; there are no more nodes
20 NeedInputNode, // The next node needs to be fetched from the contained iterator before iteration can continue
21 HaveCurrentNode, // This iterator's Current property is set to the next node in the iteration
26 /// Tokenize a string containing IDREF values and deref the values in order to get a list of ID elements.
28 [EditorBrowsable(EditorBrowsableState.Never)]
29 public struct IdIterator {
30 private XPathNavigator navCurrent;
31 private string[] idrefs;
34 public void Create(XPathNavigator context, string value) {
35 this.navCurrent = XmlQueryRuntime.SyncToNavigator(this.navCurrent, context);
36 this.idrefs = XmlConvert.SplitString(value);
40 public bool MoveNext() {
43 if (this.idx >= idrefs.Length)
46 while (!this.navCurrent.MoveToId(this.idrefs[this.idx]));
52 /// Return the current result navigator. This is only defined after MoveNext() has returned true.
54 public XPathNavigator Current {
55 get { return this.navCurrent; }