Transforming and validating xml type data