Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2011
    Posts
    6

    Question Grammar - not working as required...

    Hi there,

    I'm not good at RegExp so apologies...

    I have two xml files as follows:

    file 1:
    <process:MainProcess xmi:id="_a3oIEP7bEeSTxYPbYBfHpQ" name="XXX010101"
    <elements xmi:type="no:relevant" xmi:id="_a3oIEP7bEeSTxYPbYBfHpQ"
    etc.

    file 2;
    <process:MainProcess xmi:id="_zDewoBLTEeaBiNEICZdcCA" name="XXX010301"
    <elements xmi:type="no:relevant" xmi:id="_zDewoBLTEeaBiNEICZdcCA"
    etc.

    I've created a new File Format and a new Grammar Rule as follows:

    [xmi:id="\.23"] Category: Basic RegExp is ticked

    and what I'm looking for is that the strings xmi:id="changingString" to be shown not in blue but black.

    When Session Settings are marked as Importance=Ticked.

    Differences are shown correctly in Red, but the xmi:ids are marked as Red and Blue (not ignored) and
    name="XXX010101 is marked as different from name="XXX010301 with the three in red

    When Session Settings are marked as UnImportant=Unticked.

    Differences everything (xmi:id="changingString") is marked in Blue and
    name="XXX010101 is not marked as different from name="XXX010301, they are both Black when the three should be Red

    If I change the Grammar Rule as follows:

    [xmi:id="\w23"] Category: Basic RegExp is ticked

    the same thing happens.

    So my question is:

    How do I correctly, using the above texts as examples, isolate the only difference as being the 1 and 3 in XXX010101 and XXX010301, ignoring (black) everything in the xmi:id="changingString" ? I don't want any blue...just black and red.

    Many thanks and best regards
    SeŠn

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,366

    Default

    Hello,

    If you need a grammar to match only on xml:id" to " and mark it as Unimportant, then mark everything else as Important:
    Create a new grammar, named XMLID, and define it as a Basic =
    xmi:id="[^"]*"
    With Regular Expression enabled

    This would match on:
    the literal text of xml:id="
    [^"]* 0 ore more Not Quote characters
    the literal "
    This way, the center doesn't grab too much or multiple "'s, and will end on the first " it finds.

    Once defined, XMLID can be marked as Unimportant. Unimportant differences are Blue and are still considered Different until you also enable to the toolbar toggle: Ignore Unimportant Differences.
    The toggle will change any Blue text to Black and treat it as equal for the comparison.
    Aaron P Scooter Software

  3. #3
    Join Date
    Jan 2011
    Posts
    6

    Default

    That worked a treat once I figured out I needed to check Everything Else. Many thanks for this

    regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •