You may be interested in encryption or cryptography.
HERE is a Sun Tutorial. Frankly the first page was pretty confusing and I don't know if it gets any better as it goes.
Encrypted strings could easily contain special characters that an XML parser won't like, so you will probably have to look into escaping the encrypted data.
A very low level of security is to do your own encryption or scrambling on just the password. Any expert hacker would be able to undo anything you or I thought up in short order, but it tells an honest friend where the limits of civil behavior are. Store the encrypted password only, and when the user enters a password encrypt it and compare it to what's been stored.