IBM Support

DOORS DXL rich text function outputs double backslash characters

Troubleshooting


Problem

Attempts to export text that contains the backslash character \ using IBM Rational DOORS rich text in string function in combination with .text results in double backslash characters \\ in the output.

Symptom

The DXL output is returning two backslashes for every one backslash contained in the text.

Steps to reproduce:

Run the following DXL for an open module that contains an object with a backslash in the text:


Object o

for o in current Module do {

   string rts = richText( o."Object Text" )

   RichText rt

   for rt in rts do {

      string plainText = rt.text

      print plainText "\n"

   }

}[</code>]


Expected results: A single backslash is rendered in the output.

Actual results: Two backslashes are rendered in the output (see image below).

image

Cause

For text that contains file path locations stored in a DOORS attribute, the exported information will not let you get to the file.

Diagnosing The Problem

Verify the issue:

  1. Create a Wordpad document
  2. Insert a single backslash \
  3. Save document as RTF file
  4. Open the Wordpad document in Notepad to see its RTF markup

    You will notice that the single backslash entered is actually stored after being escaped with another
    backslash ( \\ double-slash).

    Example: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
    {\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs22\\\par
    }

Resolving The Problem

This is expected behavior.

By convention, the backslashes are stored in the actual RTF markup as escaped (inserted backslash) so that any RTF reader cannot mix them up as part of the RTF syntax.

So when you get the rich text version of a string that contains a backslash, it gives you what it actually stored which is \\ for a single slash.

If you print the object text as plain text, it is shown as a single slash.

[{"Product":{"code":"SSKR2T","label":"IBM Engineering Requirements Management DOORS"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"9.3;9.3.0.1;9.3.0.2;9.3.0.3;9.3.0.4;9.3.0.5;9.3.0.6","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Document Information

Modified date:
01 May 2020

UID

swg21586745