Functions for generation XML