Are there differences in XML 2 parser rules?

I'm having trouble with setting up the parser rules for the XML 2 file type filter in Trados Studio 2022.

I have the following XLF file, which I would like to parse based on the XML tags for simple replacement. Let's just treat it as a thought experiment Wink

Anyway, the file is detected properly, but I can't get the tags to work correctly. Here are the parsers I have set up:

Trados Studio Project Settings showing parser rules for XML tags with 'x-html-STRONG' treated as inline.

And the contents of the XLF file that I'm trying to get displayed:

Code snippet of XLF file contents with XML tags, including 'x-html-STRONG' for text emphasis.

I am trying to treat the <g> tags with the "x-html-STRONG" value for attribute "ctype" as inline, whereas the other g tags can simply be handled as structure. With the setting above, I would expect to get at least SOME text in my translation editor (e.g. "zu klein ausgelegter Motor"). But nothing is showing up at all.

I'm probably missing something very easy. Does anyone see what it is?

Thanks for any help!

EDIT with more information:

I created the same parser rules in Trados Studio 2021 using the XML Embedded Content filter and the following was output, which would be more in line with what I expected:

Translation editor in Trados Studio displaying text 'zu klein ausgelegter Motor' with 'g' tags as inline.

But of course, what I'm really aiming for is this:

Trados Studio 2021 Project Settings showing parser rules with 'x-html-STRONG' tags treated as inline.

Which actually ties into my question above: Differences between Embedded Content XML file types and XML 2. And also, why was the Embedded Content XML file type removed from Trados Studio 2022 anyway?

Thanks again for any info!



Generated Image Alt-Text
[edited by: Trados AI at 4:48 AM (GMT 0) on 5 Mar 2024]
emoji
Parents Reply Children
  •  

    ok - I thought you might be able to just make one up using only the content you have shown here already?  Anyway, no problem you can email pfilkin at sdl dot com.

    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
  • Thanks for that! I was thinking it might be useful in case parent tags might play a role. Sending straightaway.

    emoji
  • Sorry, it looks like I sent I overlooked the autosuggested email address and sent it to your rws address. Hope that is OK.

    emoji
  •  

    No worries... I have your mail and will look at this later today

    Thanks

    Paul..

    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
  •   

    I'm been puzzling over this between meetings all afternoon and I cannot understand why it won't work!  So I have logged a case (Case Details - 00780593) and will come back to you when I know more.  Could be I'm doing something stupid, but your rule seems fine to me.  I created a small test that should get me this:

    Screenshot of XPath Visualizer (a software application useful for testing xpath expressions) and showing the xpath successfully picking up two elements.

    I changed one of the element names and even simplified the file a little just to remove any doubt over duplicate naming, but still have this problem you reported.

    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
  • Thanks for looking into it. I also considered those possibilities and did the same (thinking e.g. the hyphens in the attribute might be the culprit). Very interested to see what comes out of this. I have another question regarding XML2 and WorldServer but I will post that in the appropriate forum.

    emoji
  •   

    So... I was doing something stupid.  I disregarded the name space.  So if I use my same sample file with this rule:

    //p0:parentg    (structure)

    //p0:parentg/p0:g[@ctype='x-html-STRONG']     (inline)

    //*   (not translatable)

    And set the namespace to:

    P0

    p0 urn:oasis:names:tc:xliff:document:1.2

    Then I get this:

    Screenshot showing the custom XML filetype preview using the new parser rules.  The text is correctly parsed into two segments with the inline element tagged at the end of the first segment.

    I would add that the reason it worked for me in my test is because I ignored the folded group in my xpPath tester that automatically added the namespace info!! Once I expand it you can see this:

    Screenshot of the XPath Visualizer "namespaces and prefixes" section showing the namespace populated automatically.

    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
  • Hi Paul, that's fantastic that you got that working! Slight smile

    Unfortunately, I know next to nothing about namespaces since I guess they weren't that necessary with the Embedded Content file type. Are there any RWS resources available where I can read up on this functionality for the XML file type?

    emoji
  •  

    that's fantastic that you got that working!

    With some assistance from  in support who pointed out my mistake.

    You keep mentioning the "Embedded Content Filetype" and I don't fully understand this.  You also have the ability to use embedded content with the XML2 filetype as well.  So I don't really understand your problem there.

    Namespaces were also used in older versions but it's actually easier to apply them now.  The XLIFF file does use a namespace so the XML2 filetype is handling this correctly.

    The help documentation is here... although not too helpful!

    https://docs.rws.com/980998/337817/trados-studio-2022/xml-namespaces

    But essentially all you need to do is set a prefix that you wish to use for the namespace.  Vlad used p0 and I left it that way but you can use whatever you like.  You can see my testing tool automatically used ns1 for the namespace in which case the xpath would have been:

    //ns1:parentg/ns1:g[@ctype='x-html-STRONG'] 

    In your xliff the namespace is this one:

    xmlns:xsi="www.w3.org/.../XMLSchema-instance"

    So you would add this into the filetype settings:

    Screenshot showing the "Namespace" settings wth a prefix value of "p0" and a Uri value of "p0	urn:oasis:names:tc:xliff:document:1.2".

    A good resource to learn more about namespaces would be https://www.w3schools.com/xml/xml_namespaces.asp

    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
  • Thanks for all your help!! Slight smile

    >>You keep mentioning the "Embedded Content Filetype" and I don't fully understand this.  You also have the ability to use embedded content with the XML2 filetype as well.  So I don't really understand your problem there.

    Sorry for the confusion. We are within the Trados Studio / WorldServer dynamic. Until recently, we were using WS 11.3.5, which did not support XML 2 file types, so we've never really messed with creating them in Studio. Then we upgraded to a newer version of WorldServer in December that does support XML 2 (kind of, see here). So this is the first time I've ever really worked with XML 2 even though it's been around for a bit.

    With this, I just want to make sure we are ahead of the curve whenever we do lose access to Studio 2021 and the ability to use the Embedded Content XML filter (see here, I've been busy on the forums today Yum).

    Anyway, I'm sorted now. Thanks again for all your help, the link, and the explanation as well. Top as always! Slight smileThumbsup

    emoji