Announcement

Collapse
No announcement yet.

Is it possible to increase compare priority of a XML block?

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

  • Is it possible to increase compare priority of a XML block?

    Hallo BeyondCompare support team!

    A couple of times using BeyondCompare4 I compared files comparable to the attached files. AABB_Stop.txt (which is XML, but I'm not allowed to upload files with XML extension) contains SESSION AA and BB, whereas BB_Stop.txt contains SESSION BB only. The data in the SESSION is similar to each other so BeyondCompare seems to always compare SESSION AA of the first (larger) file with SESSION BB of the second file. I would like to skip the first SESSION AA and compare SESSION BB of AABB_Stop.txt with SESSION BB of BB_Stop.txt. For me as a human it's obvious, because BeyondCompare could find a bigger equal text block...but it doesn't do it. Putting some more same text lines (for example "DuhDuhDuh" in front of SESSION sometimes helps, but it's cumbersome to do it every time.

    Is there any way to tweak the comparing behaviour of BeyondCompare to make my comparison easier? Can I for example set a higher priority for lines beginning with

    <SESSION active="true" name="

    so that BeyondCompare knows, that this line must be exactly the same?

    Hopefully I was able to explain my problem good enough. Sorry, if not!

    Thanks for your help!


    Best regards,
    Sven
    Attached Files

  • #2
    Hello,

    It looks like you have a combination of unsorted nodes and similarly named structure. I'd recommend a combination of different Alignment algorithms (Session menu -> Session Settings, Alignment tab, try Myers or Patience) and Tidied or sorted file formatting.

    The XML Tidy format also helps by normalizing whitespace and sorting your node structure. However, any edits/saves made in this view would save with this formatting, so if that shouldn't be allowed, I would suggest editing the XML Tidy format to "Disable Editing" in the Format's Conversion tab to prevent any edits/saving in this new structure. You can download XML Tidied and/or XML Sorted from here:
    http://www.scootersoftware.com/downl..._moreformatsv4
    whichever format is topmost matching *.xml in the Tools menu -> File Formats dialog is the format picked automatically when opening XML files.

    Given the similarity of the node names, this is still a difficult sample set for our Text Comparison view. You may need to tweak the alignment manually with the Align With command, which can accept selections of a node structure (select multiple lines, right click, Align With) and then multiple lines on the target side (drag select the entire node to align to).
    Aaron P Scooter Software

    Comment


    • #3
      Hi Aaron!

      Thank you very much for your help. I knew the way to sort and tidy XML code, but this is not an option as I want to merge these files and the order of the XML elements need to stay the same. But I didn't know the first and third option you mentioned. That is exactly what I was looking for! Though "Patience Diff Alignment" didn't help with the attached files (which were stripped and shortened for this request), it does exactly what I want!

      Thank you very much again!


      BR,
      Sven

      Comment


      • #4
        Hello,

        One more thing to try is to add a Line Weight of:
        <SESSION active="true" name="

        in the Tools menu -> File Formats, your XML format, Grammar tab, New "+" Line Weight (bottom box). Set priority to High. This can help impact the current alignment, and while not absolute, it helps shift the alignment algorithm to prioritize that text.
        Aaron P Scooter Software

        Comment

        Working...
        X