Announcement

Collapse
No announcement yet.

Matching algorithm when inserting xml elements

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Aaron
    replied
    Ah, thanks for the example files and clarification. I missed that earlier this post was about both line alignment and character alignment.

    For character (within a line) alignment, we appreciate the example files. The best workaround in the current version is to define a grammar that matches on different logical parts of your line. In these files, you can define a grammar, type Basic, that matches on the "this." prefix, and that then helps influence the character alignment and gets the results you expect. By defining different concepts for your files, this can help the character alignment shift and find matches.

    Leave a comment:


  • TonyRietwyk
    replied
    Same problem in BC4

    I have upgraded to BC4 and tested the different Alignment settings. None of them make any difference! According to the F1 help, they do not have any effect on the alignment of the mismatch ON A SINGLE LINE.

    What I'm asking for, is that when you find a line that doesn't match then:

    while (character before frame == last character in the frame)
    shift the frame back one character.

    Ideally you would then repeat that for each block of changes - shift it backwards while the characters before the block match the characters at the end of the block.

    I have the attached files (renamed to .txt).

    Hope that makes sense.

    Thanks!
    Attached Files

    Leave a comment:


  • Aaron
    replied
    BC4 tweaks the Standard and Myers alignment, while also adding the Patience Diff alignment algorithm. If you are unable to send in files, you can try out our BC4 trial without removing or altering your BC3 install:
    http://www.scootersoftware.com/download.php

    The alignment settings are controlled in the Text Compare's Session menu -> Session Settings, Alignment tab.

    Leave a comment:


  • TonyRietwyk
    replied
    Hello. It has been 3 years since this discussion. I never sent the files in, but I wonder if this aspect of matching has been improved? In the attached image, it should be possible to show all 6 lines with the text 'this.' highlighted as having been inserted. Thanks!
    Attached Files

    Leave a comment:


  • Aaron
    replied
    It looks like the GoogleCode project for diff-match-patch is based on the Myer's diff algorithm, which is the same algorithm our Alternate Alignment setting is based on. They might be doing some extra work to help their results, but the basic algorithm would be similar.

    Leave a comment:


  • Aaron
    replied
    Hello,

    Our current algorithm goes line by line, and does not currently match based on the syntax of the language of the file. It is something we are looking into.

    In the meantime, you can highlight multiple lines (an entire node section), and right click and choose Align With, then highlight an entire other node section to force an alignment. You can also do one line at a time.

    If you would like, please send in a pair of sample files to support@scootersoftware.com. Please also include a link to this forum thread. We can then add the files to our test cases to check against them as we try out new features.

    Leave a comment:


  • TonyRietwyk
    replied
    Thanks Chris. Changing to alternate did not make any difference. Using Unaligned, simply shows the remainder of the file as mismatched from the opening tag of the new element. Changing the Standard alignment skew, or the closeness option didn't make any difference.

    I notice that Google have released a diff-match-patch suite. How does its algorithm compare with BCs? I wonder if it has control over whether to match the previous, or next closing delimiter, when inserts occur.

    Leave a comment:


  • Chris
    replied
    Changing BC's alignment setting might change this, but it doesn't currently provide a good way to control this behavior.

    To change alignment in the Text Compare, select "Session > Session Settings". Go to the "Alignment" tab. Change from "Standard method" to "Alternate method".

    Improving the alignment algorithm is on our wish list for a future version of BC.

    Leave a comment:


  • TonyRietwyk
    started a topic Matching algorithm when inserting xml elements

    Matching algorithm when inserting xml elements

    In the attached screen shots, you can see two different ways of matching the same inserted xml element. BC3 seems to switch between them arbitrarily. With only one change, it shows as desired. With an earlier change, it highlights the 'wrong' closing tag. Is there anything I can go to influence this?

    It would be great if I could click within the mismatch, and flip between the two ways of looking at it.

    This problem also affects many other languages, eg, C++ method braces and SQL procedures.
Working...
X