A method, a system and recording medium for maintaining the order of nodes
in a hierarchical document. The method may select the maximum and the
minimum number of children for each node, build an auxiliary ordered tree
having at least as many leaves as atoms within the hierarchical document
based upon the selected maximum and minimum number of children for each
node, attach the atoms to the leaves of the auxiliary ordered tree, and
label each of the nodes in the auxiliary ordered tree.