build xml with DOMDocument for autocompletion (closes #3734)