I tried to import some XML (well structured code) to add some data to my Indesign Identifications Cards. But it wasn't well structured in the Story Editor. So first I designed one of the pages with all tags, pragraph styles, corrected with the Story Editor and exported it. Now it works perfect and looks good, even if I import it again. The problem is the code which is exported is not well structured any more when I open it with another text Editor and if I correct it, then I can not import it in Indesign without the problem recurring.
e.g. well structured code:
<parent> <child>Text</child> </parent>
e.g. poorly structured code: