Parse XML file with XML 2 in Trados 2022.

Hi all,

I can't figure how to set up a custom XML 2 file to parse a file containing this format:

<Text Name="FpsField_Title" Value="FPS" Hash="-1597113563" TranslateReason="new" />

<Text Name="CountField_Title" Value="Count" Hash="2002596872" TranslateReason="new" />

Could someone please help me remove all text but the content in the Value field? This means that "Value="FPS"" and "Value="Count"" should be shown in Trados as "FPS" as a single segment and "Count" as another segment.

I'd really appreciate any help.

Thanks in advance Pray,

-Ari

emoji
Parents Reply Children
  •  

    Should I set them as Element rules, Xpath rules or something else? Why would I use an "@" sign and not "//"? Could you please enlighten me?

    Your translatable content is all in an attribute, it's not in an element.  For example, if it was in the element you might see something like this:

    <Text Name="CountField_Title" Hash="2002596872" TranslateReason="new">Count</Text>

    Ad then you would use this to extract the translatable content:

    //Text

    But it's not, its all in the Value attribute, so the syntax to extract this is different:

    @Value

    I suggest you learn a little about using XPath before you embark on this because otherwise you'll be just guessing and not understanding anything about the solution you are using.  There are a lot of resources available on the internet to learn about XPath, but here's a few article specific to working with it in Trados Studio:

    https://multifarious.filkin.com/2013/07/30/xpath/

    https://multifarious.filkin.com/2015/11/07/x-files-ata56/

    https://multifarious.filkin.com/2014/06/01/custom-xml/

    Once you have reviewed these I'm sure you'll be able to understand what you are working with here since it's not a complex question.

    I couldn't make this work.

    Well... you do have to create your custom XML filetype first and then create your project with this custom XML filetype.  So please review the three articles above and then come back if you still have questions.  And if you do come back please provide a proper example of the filetype and not just a line from one element.  Also explain why you could not make it work... what did you actually try?

    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

    emoji