It’s inevitable that different XML parsers make different interpretations of the standards.
This is useful for pretty printing an XML document.
If the purpose of registration is to confirm that the person exists, and that they have supplied a valid email address, then as part of the registration processe you a should either email them a random password or a confirmation token rather than letting them choose their own password and use it immediately.
The code presented below would then be used for letting the user change their password.
In some cases, such as on mobile devices, displaying the password may improve usability without compromising security.
After all it's only the browser display being obfuscated and not the data transfer.