MT Plugin Segmentation Handling, post translations.

Hello, Ive built an MT plugin from the samples that are included in the SDK. Things work well, but, I have a lot of trouble handling content with tags. Here is what I have done  (conceptually anyways): 

1. Get a ref to the segment in the SearchSegment function, 

2. Create a list of Segment Elements, and create a "temporay" dictionary object, which will be used to glue the sub-segments (or elements) back together post full segment translations. 

3. Iterate over this list, and if a tag, dont send it to the server, store in my dictionary, and if text, send it for translation

4. Once all the text elements have been translated, glue the elements back together, and insert it into the target node of the segment. 

This works well. The trade off though, is that when Im sending my elements to my MT server, Im really just sending a sub segment, very likely losing full segment context information. Ultimately, Id like to send the whole segment to my MT server, with the tags, and let my server handle what it will do with the tags. To that end, Ive tested this function to get the full segment: Segment.ToString(), but, it gives me a converted string, that will convert the "native" sdl/xlf tags to a placeholder type tag. For example, in the xlff file, I have this segment: Hello, <g id="5"> how are you?</g> which is converted to Hello, <i id="5"> how are you? </i> (or something close to that). The issue I have with this, is that once translated by my server, it comes back as a string, and then, I need to convert the <i> tags back to SDL tags, and have those converted tags match what was stored in the dictionary object (mentioned above). Not the end of the world, but I was curious as to why the conversion to the generic placeholder tag was there. Is there an SDL API function that I can use that will allow me to send the FULL segment, with the "real" tags, which could then be reinserted in the target segment of the xliff file, without launching an error? or something that allow me to reconvert the tags from string mode to tag mode?  The only alternative I can think of, is to bypass the API, and implement my own fetcher functionality, from the XLFF file itself (which I have done)... but id like to find out if I can skip this last step, and use something available via the API. 

 

Oh, also, before someone suggests it: I can certainly send the full segment in plain text mode, but then, i lose all my tag/formatting info, which is not a good option when translating tag heavy documents...