XML folding