示例#1
0
        /// <summary>
        /// Moves to the next record.
        /// Returns true when record position can be advanced and false when there are no more records to be retrieved.
        /// </summary>
        /// <returns>True/false indicating if operation succeeded.</returns>
        public bool MoveNext()
        {
            ReaderPositionState state = _readerState.Peek();

            if (state.CurrentNodes.Count > state.CurrentPosition + 1)
            {
                ++state.CurrentPosition;
                state.CurrentNode = state.CurrentNodes[state.CurrentPosition];

                return(true);
            }

            return(false);
        }
示例#2
0
        /// <summary>
        /// Pushes the reader state onto the stack.
        /// </summary>
        /// <param name="node">The node to be pushed onto the stack.</param>
        private void PushReaderState(XmlNode node)
        {
            // If the node is not null then create a new object with the values.
            // Otherwise, if the node is null, simply push an empty object onto the stack
            // since the MoveParent method will be called immediately afterward.
            if (node != null)
            {
                ReaderPositionState state = new ReaderPositionState
                {
                    CurrentId       = node.Attributes["name"].Value,
                    CurrentNodes    = node.SelectNodes("Record"),
                    CurrentPosition = -1
                };

                _readerState.Push(state);
            }
            else
            {
                _readerState.Push(new ReaderPositionState());
            }
        }