private IContainer DoIterator(Iterator tag, IContainer parent, XmlNode node, ValueStack.ValueStack stack) { var collection = (IEnumerable)stack.Evaluate(tag.Value, null, false); var status = new IteratorStatus(); if (!String.IsNullOrEmpty(tag.Status)) stack.Push(tag.Status, status); //push status variable var list = new ArrayList(); var reader = collection as IDataReader; if (reader != null) { while (reader.Read()) { stack.Push(tag.Id, reader); ProcessChildren(parent, node, stack); status.Inc(); } } else { foreach (var item in collection) list.Add(item); foreach (var item in list) { stack.Push(tag.Id, item); ProcessChildren(parent, node, stack); status.Inc(); } } if (!String.IsNullOrEmpty(tag.Status)) stack.Values.Remove(tag.Status); //remove status variable return parent; }
private void DoIterator(Iterator tag, ValueStack stack, System.Xml.XmlNode node, System.Xml.XmlWriter w) { System.Collections.IEnumerable collection = (System.Collections.IEnumerable)stack.Evaluate(tag.Value, null, false); if (collection is System.Data.IDataReader) { while (((System.Data.IDataReader)collection).Read()) { stack.Push(tag.Id, collection as System.Data.IDataRecord); ProcessChildren(stack, node, w); } } else { System.Collections.IEnumerator enumerator = collection.GetEnumerator(); while (enumerator.MoveNext()) { stack.Push(tag.Id, enumerator.Current); ProcessChildren(stack, node, w); } } }