Translating XML with Entities conversion


Hello everybody!

This is my first post here so I'm apologizing in advance if I write something the way I'm not supposed to.

I have a problem with "SDL Trados Studio 2015 SR2 - 12.2.5099.5" while trying to translate XML with custom created XML file type.
Inside the XML are "property" tags and inside every "property" tag is HTML that has to be translated.
The problem is that HTML has entities that are coded like ">", "<", "&" and so on.

This is an example of one "property" tag:

<property isMultiValue="false" nodePath="/some/path:content" propertyName="text">&lt;h1&gt;Headline 1&lt;/h1&gt;
&lt;p&gt;This is first paragraph with &lt;strong&gt;bold&lt;/strong&gt; and &lt;em&gt;italics&lt;/em&gt; text.&lt;/p&gt;
&lt;p&gt;This is second paragraph with &lt;a data-rte-link="true" data-rte-button="true" href="http://www.google.com" target="_blank"&gt;link to google&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is third paragraph with non-breaking&amp;nbsp;space.&lt;/p&gt;
</property>

I've managed to set-up custom XML file type the way it converts all "&gt;", "&lt;" and "&amp;" into ">", "<" and "&" (and vice versa, when Trados is saving target file), but I am not able to set it up the way is shows inline tags instead of text.

For example, Editor in Trados Studio is showing "<h1>Headline 1</h1>" which is better than "&lt;h2&gt;Headline 1&lt;/h2&gt;" but it would be best if it would recognize <h1> as an inline tag.

It does not have any difference if I tick on "Convert numeric entity references to inline placeholder tags" or not. The results are the same - HTML tags are displayed in plain text form instead of an (inline) tags.

Does anybody know how to solve this problem?

Thank you in advance!

Best regards,
Tom

Parents Reply
  • Hi ,

    This thread is a few years old now. I was able to learn a few things about XML filetypes with all the info. However, I am still a little lost with regards to one thing:

    If the HTML content is not inside a CDATA section but instead inside a normal XML element, all ampersands have to be escaped in order for the document syntax to be valid. The example section from Tomislav has such an entity:

    Here, the ampersand of the entity "&nbsp;" has been escaped with "&amp;".

    If I add this file like this to a Studio project, Studio would convert the ampersand entity leaving me with the unconverted "&nbsp;" entity in the text.

    I have not understood yet, if there is a solution to this case other than replacing the ampersand entity with an actual ampersand. Unfortunately, doing this results in the XML syntax being faulty due to undeclared entities. Which then leads to having to replace the whole entity with the actual symbol.

    Is there something I missed in your articles and videos? I would appreciate your help on this.

Children
No Data