Hi Hilary,
you're right, I meant Infopath 2013, I fixed my message.
My issue is not so much to fix the formatting when I need, I can do it with an editor as you propose or xmllint command. The point is that we manage several tens of xml forms in version control.
We can't ask people in our team to re-format XML files after editing ...