Scala has a great way to handle it using triple - double quotes. In scala this would work fine
val xml = """ <user type="simple"/> """
but if you are stuck with java, then eclipse can escape the string for you..
Go to Window>Preference>Java>Editor>Typing and check the “Escape text when pasting into a string literal“
Check this article for some nice screenshots