Attribute alignment when comparing XML tags with many attributes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Henrik Helmø Larsen
    Visitor
    • Jun 2016
    • 3

    Attribute alignment when comparing XML tags with many attributes

    I am using a modified version of the XML Tidied Format. There are a lot of attributes I want to ignore (this could be a modified_date or modified_by which changes whenever somebody changes the content of a tag. The modified_by and modifyed_data bubbles all the way to the top element in our documents.
    When using the XML Tidied format - Beyond Compare nicely shows which lines differ in two files. It also (very often) align lines in the XML file correctly.
    My question: When I have multiple attributes on a XML tag. Some of them I want to ignore - how do I make sure alignment is done correctly.
    See the following screen-dump:

    Notice that NO="1" don't align in the two lines. It should be noted that all attributes next to NO are ignored.
    Can BC be set op to align in a specific way? I want MODIFIED_BY to always be aligned with MODIFIED_BY etc?

    (In the screenshot I have shown my Rules for XML Tidied)
    Attached Files
  • Aaron
    Team Scooter
    • Oct 2007
    • 15997

    #2
    Hello,

    The issue here is that the tidy restructures the text, but line by line we still compare the characters in the line as plain text. The Text Compare aligns character by character as best it can using an algorithm that approaches the entire line. Note the very long numeric string (P_Z="" on the left, and part of Modified on the Right) that is aligned; this will then push other text to the left and right of this matching section. The NO="1" text in the left file is before this section, and is to the right in the right file. It appears the attributes are different Left <-> Right but contain some of the same values? The Tidy would sort the attributes first, and then align; given the length of the value text it will often be matched upon.

    Is it intended to have different attributes with the same value? Should this be aligned? Should the right side be reconciled to have matching attributes?
    Aaron P Scooter Software

    Comment

    • Henrik Helmø Larsen
      Visitor
      • Jun 2016
      • 3

      #3
      Originally posted by Aaron
      It appears the attributes are different Left <-> Right but contain some of the same values?
      Yes that is correct. Some attributes exist in the left file and not in the right file. The attributes that don't exist in both are supposed to be ignored (P_Z="..", P_CHI2="...",etc). And some attributes that DO exist in both (MODIFIED and MODIFIED_BY) I want to ignore because they (almost) always differ. What is left is eg: NO="1", ESTIMABLE="YES" on left and ESTIMABLE="NO" on right. In this case I want Beyond Compare to match NO="1" in both files since they are the same - BUT I want Beyond Compare to tell me that ESTIBALE is different in the two files <- this is the information I am looking for...

      Originally posted by Aaron
      The Tidy would sort the attributes first, and then align; given the length of the value text it will often be matched upon.
      It is super that Tidy sorts the attributes - this makes it easier to compare...

      Originally posted by Aaron
      Is it intended to have different attributes with the same value?
      It is not intentional to have different attributes with same values - I don't think that is the case in the screenshot.

      Originally posted by Aaron
      Should this be aligned?
      I would expect Beyond Compare to align same attributes underneath each other in the two lines at the bottom of the screen. I would NOT expect Beyond Compare to align something in the bottom line with something above that is to be ignored...? - This is exactly what happens with:
      ESTIMABLE="YES" I2="50...314" I2_Q="0.0"
      when it is compared to:
      ESTIMABLE="NO"
      In this case the last quote from I2_Q="0.0" is matched with the last quote of ESTIMABLE="NO" even though I2="..." and I2_Q="..." both should be ignored according to the rules in the top of the screenshot?!?

      Originally posted by Aaron
      Should the right side be reconciled to have matching attributes?
      I am not sure what this means - but if it means aligning the same attributes then yes!

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 15997

        #4
        Would it be possible to get a pair of sample files and your current BCSupport.zip (Help menu -> Support; Export)? The current dilemma is that the value of the text is aligning based on the entire text of the line, not just the attribute names.

        When you email us at [email protected], please include a link back to this forum thread for our reference.
        Aaron P Scooter Software

        Comment

        • Henrik Helmø Larsen
          Visitor
          • Jun 2016
          • 3

          #5
          Sorry for the long delay
          I have sent a mail to support with some sample files - hope it is of use to you

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 15997

            #6
            Hello,

            XML Tidied can sort and tidy nodes, but maintains the structure. If an attribute (MODIFIED or MODIFIED_BY) is in a PERSON node on one side but the CREATOR node on the other, and both nodes exist on both sides, then this moved data and would be a difference. This is at least once difference I found in the example that might be confusing, but in your original files appears to be a real difference that shouldn't be sorted/moved from one node into another.
            Aaron P Scooter Software

            Comment

            Working...