CodeMirror: XML Autocomplete demo

Type '<' or space inside tag or press ctrl-space to activate autocompletion. See the code (here and here) to figure out how it works.