This script features an iterated method of traversing a tree-structure (specifically, a tree created by the Rebol 2 mezzanine PARSE-XML). The iterator returns events—OPEN, CLOSE, EMPTY, and TEXT—upon request until the tree has been fully traversed.
Using an iterated approach to tree traversal allows for fine control of the process that can be dropped and picked up fairly intuitively, effectively reducing the traversal process to a linear stream of events useful for serialization or extraction. This stands in contrast to the callback approach that fully traverses a tree firing callback functions until the tree has been fully traversed.