After editing a SXLXLIFF file the target XML is not valid

I want to mark pretranslated segments in the XLIFF file to see it in the translated xml file.

In the original file I have a part which looks like: <footnote><footnotetext>text</footnotetext></footnote>.

In the XLIFF file it looks like <target><g id="1123"><g id="1125">text</g></g>.

Now I add a new tag definition to the XLIFF file (in tag-defs) and modify the segment to: <target><g id="1123"><g id="1125"><g id="7724">text</g></g></g>.

After that Trados creates no valid XML when I save the target language. The result looks like <pretranslated><footnote><footnotetext>text</footnote></footnotetext></pretranslated> (The closing "footnote" and "footnotetext" are swapped.

What can I do to avoid this? Is there another way to store the information in the target file?