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
  • Hi Daniel, thanks. I will add a better screenshot soon.

    I am just a bit puzzled why the files are appearing with all the embedded content visible. Tridion seems to be SDL software and I would expect the files to be easier to handle. Maybe I am missing something.

  • There are many possibilities to customize how xml files are read by Studio, it's widely used format. There are standard methods to deal with embedded content etc.

    If you can post a snippet of the file here then people will find it easier to help. Please post text, not a screenshot...

    Daniel

  • 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]
Reply Children
No Data