Why is the xml declaration removed? Sometimes it is included by Idps, so the code should handle it.