refactor xml handling to be separate from tree traversal