The retention period for electronic invoices (the original of which is the XML file) is the same as for non-digital invoices: ten years. That is the period of time for which you must securely store relevant documentation in digital form.