XML Parser Rule Settings

The XML parser rules specify the structure of XML files. For example, they determine what content is translatable text and what is non-translatable.

The Parser Rules Page

This page contains the list of parser rules, and has buttons to enable you to add, delete and modify the rules. You cannot edit the rules directly on this page. Click Add or Edit to display the dialog box that lets you change the parser rules settings.

Parser rule settings (Add Rule and Edit Rule)

Rule Type and Rule
The specification of the nodes to which the rule applies, one of the most important properties of a parser rule. The software uses XPath to specify the applicable nodes. The software uses this specification to identify the rule, and so does not allow you to have two rules with the same XPath location.

Choose a method to specify the nodes:

  • XPath. Specify the XPath directly.
  • Attribute. Specify the XPath by providing an element attribute pair.
  • Element. Specify the XPath by providing an element name.

The Attribute and Element methods allow you to specify a rule even if you do not know XPath syntax.

Translate setting
Content that is translatable can be edited. Content that is not translatable might or might not be displayed: that depends on its tag type.

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 setting translatable from its ancestor.
The translate setting is one of:
Always translatable
The content can be edited.
Not translatable
The content is displayed to the translator but cannot be edited.
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.

If the Translate setting is Not specified, you cannot also set the tag type to be Not specified.

Tag Type
A parser rule 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 tag is marked as a structure tag.
Note: You cannot set both the Translate setting and the tag type to Not specified.
Whitespace
For XML file types, you can choose whether the file filter software preserves whitespace or normalizes it. Preservation means that whitespace is not modified. Normalization means replacing whitespace with a single space. Normalization is done when the file is converted to sdlxliff. You can set the whitespace setting for a file type as a whole in the Whitespace page. You can also set the whitespace setting in a parser rule. Where a parser rule applies, it overrides the setting from the Whitespace page).
Normalization replaces the following whitespace with a space:
  • Whitespace within text
  • Whitespace between text and any tag
  • Whitespace between inline tags
  • Whitespace between an inline tag and a structure tag

Normalization does not change the whitespace between structure tags. (The user does not see this whitespace anyway.)

Advanced parser rule settings applicable to inline tags

Inside text the tag acts as a word end
If selected, then the translation editor treats the tag as text for the purposes of navigation. For example, when you press Ctrl+Left Arrow, the editor moves the cursor to the beginning of the tag.
Text lines can be wrapped after the tag
Use this option where a line break after this tag is for formatting purposes, and does not indicate the end of a segment. For example, the following single sentence is broken by a <br> tag:

The owl and pussy-cat went to sea <br>

in a beautiful pea green boat.

Tags represent formatting only and can be hidden in the editor
In the editor, text is formatted correctly but formatting tags are not displayed. The translator can change the editor settings to display the tags.
Tag represents the text
Only relevant for standalone (placeholder) tags. A tag can have a text equivalent. For example, the entity tag &quot; has the text equivalent " (quotes).
Segmentation Hint
Include
The tag will be displayed in the editor, even if it has no associated text. You would rarely select this option.
Include with text
The tag will be displayed in the text when it has associated text.

Example: the tag specifies a footnote marker. Where this is the case, the translator needs the ability to attach the marker to another word in the same sentence, so the tag should be included as part of the text.

may exclude, Undefined
These two are effectively the same. The editor determines whether the tag is part of the text.

Advanced parser rule settings applicable to Structure tags

The length restrictions options specify limits on the number of Unicode characters that can be entered in the translation for an element or attribute.

The length restrictions are displayed in the translation editor, in the document structure column and in a tooltip. If in the QA Checker, the Check if target segments are within file specific limits is enabled, these length restrictions are checked.

You can set length restrictions for elements and for translatable attributes. For example, you could set a restriction on the length of a <title> element in a document or an attribute such as an image description in a document.

Minimum length
The shortest length that a user can enter as the element's translation. SDL recommends entering a relative XPath address. For example if minlength is the elements's attribute, enter @minlength. However, you can use a constant, such as 40.
Maximum length
The longest length that a user can enter as the element's translation. SDL recommends entering a relative XPath address. For example if maxlength is the elements's attribute, enter @maxlength. However, you can enter a constant, such as 4096.