Provide template editing for documents

i should be able to edit as a form derived by xml and see it in the proper visual format. but when I edit i should be able to edit as a form

call it structured documents