Philips Interview Question

Design an algorithm for walking a tree-like data structure and serialize it XML