Well-formed XML in brief
Well-formed XML has exactly one root element, every opening tag has a matching closing tag (or is self-closing like <item/>), tags are properly nested, and attribute values are quoted. The validator reports the first problem with its line and column, so you can fix SOAP envelopes, configuration files or feeds quickly.
When to escape XML
Inside text and attribute values the characters < > & " ' have special meaning. Escaping turns them into entities such as < and & so that data like code snippets or user input can be embedded safely. Unescape does the reverse and also decodes numeric entities such as ş.