![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: DXL to compare child and parent text Topic Summary: Created On: 11-Dec-2008 17:29 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I need to write a DXL to compare the object text of an object and the object text of an object that the object links to, and 1.) determine if there is a different between these two object texts, and 2.) ideally indicate what those differences are. Has any one done anything like this? Is there a DXL available that does something similar? Any ideas on how to best tackle this? Thanks in advance.
|
|
![]() |
|
![]() |
|
look at diff function
|
|
![]() |
|
![]() |
|
The 'diff' function compares two texts and produces a very nice red-lined difference between them. That difference can be put in an attribute, placed in a richText DBE, or exported to Word. Its very nice but not quite perfect.
As far as your DXL parsing the difference to find exact phrase changes, that's another matter. I'd practice with two texts that are slightly different and send the 'diff' to a *.txt file, and open it with Notepad. The texts should include some odd characters specifically including /\{}. Its somewhat possible you will see patterns and can write a DXL parser, probably finding which portions of the text are the same and deducing which are different. Good luck. Be advised that 'diff' won't work on text that has rich text markup, so be sure to get the raw text from the attributes in question; Text1 = obj.MyAttr, do not get the rich text: Text1 = richText(obj.MyAttr). - Louie |
|
![]() |
|
![]() |
|
Hmmm. I'm a little confused on how to use the diff function. I'm starting off small trying to just comapre two attributes in the same module as below:
string sone = obj."Object Text" string stwo = obj."newtext" Buffer one = create Buffer two = create Buffer result = create one = sone two = stwo diff(result, one, two, false) display stringOf(result) "\n\n" diff(result, one, two, true) display stringOf(result) But the results show up with what seems to be Rich text formatting like such: {\rtf1\deff1000{\fonttbl{\f1016\fswiss\fcharset134 Tahoma;}{\f1015\fswiss\fcharset136 Tahoma;}{\f1014\fswiss\fcharset129 Tahoma;}{\f1013\fswiss\fcharset128 Tahoma;}{\f1012\fswiss\fcharset177 Arial;}{\f1011\fswiss\fcharset162 Arial;}{\f1010\fswiss\fcharset238 Arial;}{\f1009\fswiss\fcharset204 Arial;}{\f1008\fswiss\fcharset161 Arial;}{\f1007\fswiss\fcharset0 Arial;}{\f1006\froman\fcharset177 Times New Roman;}{\f1005\froman\fcharset162 Times New Roman;}{\f1004\froman\fcharset238 Times New Roman;}{\f1003\froman\fcharset204 Times New Roman;}{\f1002\froman\fcharset161 Times New Roman;}{\f1001\ftech\fcharset2 Symbol;}{\f1000\froman\fcharset0 Times New Roman;}}{{\colortbl ;\red255\green0\blue0;\red0\green255\blue0;\red0\green0\blue255;} How do I get the results to show up with actual redlining in the DXL column? Or can I even do so? Thanks for any assistance. |
|
![]() |
|
![]() |
|
If you are using layout dxl - I suppose you are doing it because of the display statement in your code - you can display the text including markups by using displayRichWithColor.
Cheers, Frank ------------------------- Frank Jensen TRW Automotive frank.jensenREMOVE_ME@trw.com |
|
![]() |
|
![]() |
|
That looks better. Excellent! Thanks everyone for your help and suggestions.
|
|
![]() |
Telelogic DOORS
» DXL Exchange
»
DXL to compare child and parent text
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.