How do I handle xml files from the CMS Tridion?

One of our clients sent us a XML file from the cms Tridion. Is there a way to translate these files and handle the tags and embedded content properly without having to come up with regex ourselves?

Please see a screenshot below of what part of the text looks like right now in SDL Studio 2019.

Screenshot of SDL Trados Studio 2019 showing an XML file open in the Editor view with multiple lines of code and tags. The Translation Results pane is visible on the right side, and there are no visible errors or warnings.



Generated Image Alt-Text
[edited by: Trados AI at 10:19 AM (GMT 0) on 29 Feb 2024]
emoji
Parents Reply Children
  • Thank you for your reply Daniel. I opened the file in Notepad++ and copy/pasted some text below.

    We have handled xml files for clients before and we have used custom xml file types and (with help) used regular expressions but maybe someone has already figured out a way to handle xml files from Tridion in Studio?

    <Component tcm-id="tcm:837-164159" LastModifiedDate="2018-07-19T16:26:34" title="Vence - 01 - X - Key activities - List">
    <title>Key activities : developping customized control solution and smart services for HVAC systems &amp;amp; plant room</title>
    <menuitems>tcm:837-164157</menuitems>
    <menuitems>tcm:837-164158</menuitems>
    <menuitems>tcm:837-164174</menuitems>
    <menuitems>tcm:837-164175</menuitems>
    <relatedlinks>
    <openinwhichwindow>NewWindow</openinwhichwindow>
    </relatedlinks>
    </Component>
    </Schema>
    <Schema tcm-id="tcm:837-102651-8">
    <Component tcm-id="tcm:837-164177" LastModifiedDate="2018-07-17T13:36:57" title="Vence - 03 - Equipments/Countries/Electricity/Kwh">
    <content> &amp;lt;div style="width: 100%; background-color:white;"&amp;gt;
    &amp;lt;div class="container container-theme container-theme-medium" style="overflow:hidden;text-align:center;"&amp;gt;
    &amp;lt;div class="row" style="text-align:center;margin-top: 20px;"&amp;gt;


    &amp;lt;div class="col-sm-3"&amp;gt;
    &amp;lt;div style="background-color:#16468e;height: 120px; box-shadow: 0 0.1rem 0.3rem rgba(0, 24, 48, 0.2); display: flex; flex-direction: column; justify-content: center;"&amp;gt;&amp;lt;h3 class="heading-alt" style="margin: 0px;"&amp;gt;&amp;lt;span style="color:white;"&amp;gt;+1 300&amp;lt;/span&amp;gt;&amp;lt;/h3&amp;gt;
    &amp;lt;h4 class="heading-alt" style="margin-top: 0px;"&amp;gt;&amp;lt;span style="color:white;"&amp;gt;Connected equipments&amp;lt;/h4&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;div class="col-sm-3"&amp;gt;
    &amp;lt;div style="background-color:#16468e;height: 120px;box-shadow: 0 0.1rem 0.3rem rgba(0, 24, 48, 0.2); display: flex; flex-direction: column; justify-content: center;"&amp;gt;&amp;lt;h3 class="heading-alt" style="margin: 0px;"&amp;gt;&amp;lt;span style="color:white;"&amp;gt;+3 000&amp;lt;/span&amp;gt;&amp;lt;/h3&amp;gt;
    &amp;lt;h4 class="heading-alt" style="margin-top: 0px; "&amp;gt;&amp;lt;span style="color:white;"&amp;gt;Customers&amp;lt;/span&amp;gt;&amp;lt;/h4&amp;gt;&amp;lt;/div&amp;gt;

    &amp;lt;/div&amp;gt;
    &amp;lt;div class="col-sm-3"&amp;gt;

    &amp;lt;div style="background-color:#16468e;height: 120px;box-shadow: 0 0.1rem 0.3rem rgba(0, 24, 48, 0.2);display: flex; flex-direction: column; justify-content: center;"&amp;gt;&amp;lt;h3 class="heading-alt" style="margin: 0px;"&amp;gt;&amp;lt;span style="color:white;"&amp;gt;+500 MW&amp;lt;/span&amp;gt;&amp;lt;/h3&amp;gt;
    &amp;lt;h4 class="heading-alt" style="margin-top: 0px; "&amp;gt;&amp;lt;span style="color:white;"&amp;gt;Electricity saved&amp;lt;/span&amp;gt;&amp;lt;/h4&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="col-sm-3"&amp;gt;
    &amp;lt;div style="background-color:#16468e;height: 120px;box-shadow: 0 0.1rem 0.3rem rgba(0, 24, 48, 0.2); display: flex; flex-direction: column; justify-content: center;"&amp;gt;&amp;lt;h3 class="heading-alt" style="margin: 0px;"&amp;gt;&amp;lt;span style="color:white;"&amp;gt;+6 000 000 KWH&amp;lt;/span&amp;gt;&amp;lt;/h3&amp;gt;
    &amp;lt;h4 class="heading-alt" style="margin-top: 0px;"&amp;gt;&amp;lt;span style="color:white;"&amp;gt;Daily transfer&amp;lt;/h4&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;/div&amp;gt;
    &amp;lt;p style="text-align: left;margin-top:20px;"&amp;gt;&amp;lt;em&amp;gt;Source: Estimates based on existing TES solutions at customer sites&amp;lt;/em&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;</content>

  • Hello Daniel, thank you for your reply. We have handled xml files from clients before using custom file types and (with help) regular expressions.

    I was hoping there would be a standard way to handle xml files from Tridion or maybe a Community user has already figured out how to do it.

    Please see below some text that I copy/pasted after opening the file in Notepad++.

    <Component tcm-id="tcm:837-164159" LastModifiedDate="2018-07-19T16:26:34" title="Vence - 01 - X - Key activities - List">
    <title>Key activities : developping customized control solution and smart services for HVAC systems &amp;amp; plant room</title>
    <menuitems>tcm:837-164157</menuitems>
    <menuitems>tcm:837-164158</menuitems>
    <menuitems>tcm:837-164174</menuitems>
    <menuitems>tcm:837-164175</menuitems>
    <relatedlinks>
    <openinwhichwindow>NewWindow</openinwhichwindow>
    </relatedlinks>
    </Component>
    </Schema>
    <Schema tcm-id="tcm:837-102651-8">
    <Component tcm-id="tcm:837-164177" LastModifiedDate="2018-07-17T13:36:57" title="Vence - 03 - Equipments/Countries/Electricity/Kwh">
    <content> &amp;lt;div style="width: 100%; background-color:white;"&amp;gt;
    &amp;lt;div class="container container-theme container-theme-medium" style="overflow:hidden;text-align:center;"&amp;gt;
    &amp;lt;div class="row" style="text-align:center;margin-top: 20px;"&amp;gt;


    &amp;lt;div class="col-sm-3"&amp;gt;
    &amp;lt;div style="background-color:#16468e;height: 120px; box-shadow: 0 0.1rem 0.3rem rgba(0, 24, 48, 0.2); display: flex; flex-direction: column; justify-content: center;"&amp;gt;&amp;lt;h3 class="heading-alt" style="margin: 0px;"&amp;gt;&amp;lt;span style="color:white;"&amp;gt;+1 300&amp;lt;/span&amp;gt;&amp;lt;/h3&amp;gt;
    &amp;lt;h4 class="heading-alt" style="margin-top: 0px;"&amp;gt;&amp;lt;span style="color:white;"&amp;gt;Connected equipments&amp;lt;/h4&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;div class="col-sm-3"&amp;gt;
    &amp;lt;div style="background-color:#16468e;height: 120px;box-shadow: 0 0.1rem 0.3rem rgba(0, 24, 48, 0.2); display: flex; flex-direction: column; justify-content: center;"&amp;gt;&amp;lt;h3 class="heading-alt" style="margin: 0px;"&amp;gt;&amp;lt;span style="color:white;"&amp;gt;+3 000&amp;lt;/span&amp;gt;&amp;lt;/h3&amp;gt;
    &amp;lt;h4 class="heading-alt" style="margin-top: 0px; "&amp;gt;&amp;lt;span style="color:white;"&amp;gt;Customers&amp;lt;/span&amp;gt;&amp;lt;/h4&amp;gt;&amp;lt;/div&amp;gt;

    &amp;lt;/div&amp;gt;
    &amp;lt;div class="col-sm-3"&amp;gt;

    &amp;lt;div style="background-color:#16468e;height: 120px;box-shadow: 0 0.1rem 0.3rem rgba(0, 24, 48, 0.2);display: flex; flex-direction: column; justify-content: center;"&amp;gt;&amp;lt;h3 class="heading-alt" style="margin: 0px;"&amp;gt;&amp;lt;span style="color:white;"&amp;gt;+500 MW&amp;lt;/span&amp;gt;&amp;lt;/h3&amp;gt;
    &amp;lt;h4 class="heading-alt" style="margin-top: 0px; "&amp;gt;&amp;lt;span style="color:white;"&amp;gt;Electricity saved&amp;lt;/span&amp;gt;&amp;lt;/h4&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="col-sm-3"&amp;gt;

  • From what I can see you extract the <title> and <content> elements.

    Most of the text you copied is HTML formatting, so you will have to use a custom XML file type with embedded HTML content processor.

    Trados Studio screenshot showing the 'Embedded content' settings with an arrow pointing to the 'Add...' button.

    Screenshot of Trados Studio 'File Types' settings with a focus on 'Rule' section, highlighting the 'Element' rule type and 'content' element.

    You should not need to use any Regex here, just Xpath to describe what you want to translate, but really, you just need to know the name of the elements you want to use:

    Close-up of 'Add Rule' dialog box in Trados Studio with 'Rule type' set to 'Element' and 'Element' dropdown showing 'content' selected.

    Daniel

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 10:19 AM (GMT 0) on 29 Feb 2024]
  • We have handled xml files from clients before using custom file types and (with help) regular expressions.

    That's incorrect way. XML files should NOT be handled as plain text! You should be handling XML files as XML, i.e. using custom XML file type.

    See the Paul's article for a starter: multifarious.filkin.com/.../

  • Adding to what pointed out, XML is very flexible. That's both glory and misery - you will have to adapt your custom XML file type (surely with embedded HTML processor in your case) to suit your customer's implementation of their CMS. I never had anything to do with Tridion, but I am almost 100% certain that the localizable fields will vary from implementation to implementation and again within the CMS from item to item. Best would be if your customer could tell you what they want translated (Title, Content, Author, Metadata fields etc.)

    It's a bit of a learing curve, but I found these tutorials easy to understand:

    https://www.w3schools.com/xml/default.asp

    https://www.w3schools.com/xml/xpath_intro.asp

    Daniel

  • Thank you all. This is helpful! 

    I read that Tridion is a cms developed by SDL and that is why I was wondering if there would be a pre-defined file type to handle xml files from Tridion. We will look into the instructions for Xpath.

  • Hi

    Tridion XML should be ITS (https://www.w3.org/International/its/ig/Overview) which means it should open automagically in Studio without you having to anything.  But like anything the exports are probably customisable so if you need to do something to get at your translatable text it mimght be worth chatting to whoever prepared the files and sent them to you.

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • As a follow-up for anyone who comes across this question, Tridion Sites is indeed an SDL, now RWS, offering. It integrates with the enterprise translation management systems from RWS including TMS, WorldServer, and Trados Enterprise.

    There isn't a direct integration to Trados Studio, though CMS editors could send and re-upload source XML files as mentioned above.

      explained the expected format from Tridion Sites is ITS. This is the preferred approach and the ITS files are generated when using the Translation Manager feature in Tridion Sites to send CMS items to one of the above mentioned translation management systems. After jobs are received from the CMS to the translation system, linguists could work on the ITS files at the appropriate steps in the workflow (such as .For more information on Translation Manager, see the RWS Documentation Center topic.

    Note that a Tridion Sites customer would need to first set up Translation Manager and a corresponding workflow in the TMS in order to send and receive translation jobs from the CMS.

    Alvin Reyes | RWS

    Twitter: @Nivlong | Personal Blog: CreateandBreak

    emoji