Documentation Center

Adding XML Parser rules

SDL Trados Studio uses a default set of Parser rules for extracting content from the most important types of XML files. Use the Parser rule settings to define the properties of the XML parser rules. As a result, SDL Trados Studio can better sort translatable from non-translatable text and correctly display the extracted content.

About this task

When a file does not match the detection rules of any of the default XML file types, SDL Trados Studio processes it with the XML: Any XML file type. If you do not want SDL Trados Studio to apply the default Parser rules for extracting XML content, you can create a new XML file type with custom Parser rules. You can also customize the existing Parser rules for the XML file types whose Parser rules can be edited.

Procedure

  1. Decide for which projects you want to configure file type settings:
    • For the active project, go to the Projects view, and on the Home tab, select Project Settings.
    • For all future projects, go to File > Options.
  2. Expand the File Types tree.
  3. Select an XML file type for which you want to add XML Parser rules.
  4. Select Add....
  5. In the Add Rule dialog, select a rule type from the Rule type list. SDL Trados Studio uses XPath to specify the applicable nodes. This specification helps SDL Trados Studio to identify the rule, and so does not allow you to have two rules with the same XPath location. Provide one of the following:
    • Attribute - Provide the element attribute pair, even if you do not know XPath syntax.
    • Element - Provide an element name, even if you do not know XPath syntax.
    • XPath - Provide the XPath directly.
  6. Under Properties:
    1. In the Translate list, assign a translation setting to an XML element:
      • Always translatable - The content of the XML element can be edited in the Editor view.
      • Not translatable - The content is displayed as locked content and cannot be edited. When a translatable element creates a separate segment, SDL Trados Studio only displays it with the All content filter in the Review tab. This is because you would not normally need to see a segment that only contains locked and not translatable content.
      • Translatable (but not in protected content) - Translatable unless the parent element is not translatable. Effectively the same as Not Specified.
      • Not specified - The element inherits the parent's translatable setting, if there is such a setting. Otherwise, the setting is Translatable.
      Content is translatable if any of the following is true:
      • The content is not subject to a Parser rule.
      • The content is set in the Parser rule to translatable.
      • The content inherits the translatable setting from its ancestor.
    2. In the Tag Type list, decide how the Parser rule displays an element. SDL Trados Studio can force an element to be presented to the translator as a tag. A tag can also have translatable text. A tag can be specified as any of the following:
      • Inline with the text - The content is displayed to the translator.
      • Structure tag - The element creates a new paragraph unit in the target file.
      • Not specified - The element inherits the parent's tag setting, if there is such a setting. Otherwise, the setting is Structure.
    3. In the Whitespace list, Choose whether SDL Trados Studio preserves or normalizes any whitespace in your document. Preservation means that whitespace is not modified. Normalization replaces whitespace with a single space. Normalization is done when the file is converted to *.sdlxliff. This setting overrides the setting in the Whitespace page of your XML file type.
      • Inherit Parent. Whitespace handling is inherited from the parent element
      • Always preserve. Whitespace is not normalized
      • Normalize unless xml:space='preserve'. Whitespace is normalized unless the element has xml:space='preserve'
      • Always normalize. Whitespace is always replaced with a single space
    4. In the Formatting section, decide how formatting applies to inline tags and how the contents of an inline tag is displayed in the Editor view. For example, you might want text within an inline tag pair <b> ... </b> to be displayed as bold text. Select Edit and choose one of the following:
      • Inherit - Applies the style that is specified for the parent, if there is such a setting.
      • Activate - Applies that style to the text.
      • Deactivate - Does not apply that style to the text.
    5. In the Structure info section, you can add extra details about the context of a structure element in XML files. You can also use structure information to control how SDL Trados Studio displays the content of structure tags in the Editor view. Select Edit next to the Structure info field to change the structural properties for an XML element. You can then view this information in the Editor view, in the Document Structure column and in the Document Structure tree.
  7. Select OK.