intermediate steps in XML parsing and hierarchy reorganization