If you don't have a particular formatting method you want your data to be you may want to consider using Java's Serializable interface. It provides a convenient mechanism for saving Java objects in a format that can be easily written and read.
There's a good tutorial on how to use it
from Sun Oracle.
I can't remember if Serializable produces a human-readable output but I seem to remember that it does. In any-case, if it doesn't I believe you should still be able to use the Serializable along with the Externalizable interfaces to read/write an xml-like output.
Special characters in xml/html are handled the same way. This is done by using an ampersand (&) code. For example:
<xml>
<unit name="<3">
</unit>
</xml>
There are various special names given for specific characters. Here's a link to one site which has a list of these:
html chars. You can also use the unicode number to produce any character you want.
<xml>
<unit name="Hansel & Gretel">
</unit>
</xml>
Java has a built-in mechanisms to make parsing through XML/HTML easier than writing your own interpreter. Try googling "Java read xml" or some other variant for methods on how to do this.