Using CAT-tools to translate non-standard XML files
The XML language is supported by most modern translation memory systems. Most popular XML-based formats (such as XLIFF) have pre-defined settings. In other cases, a list of elements and attribute values to be translated must be set manually. This can be done with XPath - a query language for selecting elements from an XML document, defined by the W3C.
The basic concept of the logical structure of the XML format is an ‘element.’ Elements can be embedded in each other, forming a tree-like structure. Elements contain attributes with quoted values. XPath can be used to get only required strings from the content of an XML document.
Examples of XPath queries:
//question | //answer | Select all the "question" elements and all the "answer" elements. The "|" character is used to combine multiple queries |
//* | Select any element |
//@* | Select any attribute |
//@level | Select all values of the “level” attribute |
//question//* | Select all the elements nested in the "question" element |
//question[@translate='yes'] | Select all the "question" elements, which have “translate” attribute value “yes” |
//question[not(@translate='no')] | Do not select any "question" elements, which have “translate” attribute value “no” |
The full description of the XPath query syntax can be found here:
https://www.w3schools.com/xml/xpath_syntax.asp
Using XPath with Memsource
The XPath query value shall be entered into the field "Elements & attributes". Users can also exclude text between the tags inside any line by typing the tag name (without triangular brackets in the "Non-translatable inline elements" field).
The XPath help section on Memsource:
https://help.memsource.com/hc/en-us/articles/360001569871-XPath
Using XPath with SDL Trados Studio
You can create a new file type from the menu File -> Options -> File Types –> New.
Choose the file type "XML (Embedded Content)" . The "XML (Legacy Embedded Content)" is designed to exchange data with SDL Trados Studio 2014 and older versions.
If there is no ready settings file, chose "Create an XML file type based on the default settings" and click on “Next”.
Add the necessary XPath query on the "Parser rules" page.
Notepad++ has XML Tools which can be useful to create and check XPath queries. The plug-in can create queries for the current element or helps to check which elements match the query. ALBA Translation Agency has extensive experience of working with XML files. Our specialists can organize a work process on each job in the most optimal and therefore cost-effective manner for our customers.