Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2016
    Posts
    4

    Default xml: ignoring difference in similar numbers

    Hello,
    I have to compare lots of "similar" numbers in XML files, and consider them different only if their difference is greater than some value.

    As an example the difference between these files should be ignored by beyond compare:

    file 1: <DETAIL COD="C13" VAL="133,95"/>
    file 2: <DETAIL COD="C13" VAL="134,02"/>

    Is it possible by configuring some option, or maybe even writing some sort of plugin?

    Thanks.

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

    Default

    Hello,

    BC4 do not have a numerical tolerance value in our Text Compare (the session for XML files). We could define a grammar element to ignore specific text mask, but can't compare the numeric value between both sides.

    We do have a numeric tolerance in the Table Compare, but this session type is for data files such as CSV, with Rows/Columns and not XML files.

    Adding support for this type of comparison is on our wishlist, but is not a feature we'll be able to tackle short term. Would helping define a grammar to ignore this section of the node help? Unimportant Differences are still differences until the Ignore Unimportant Differences toggle is enabled, so you could toggle between showing and hiding any differences that occur.
    Aaron P Scooter Software

  3. #3
    Join Date
    Feb 2016
    Posts
    4

    Default

    Thank for your fast reply.
    Defining a grammar would not help, unfortunately, but I can develop a tool to convert my XML files to CSV and then use the numeric tolerance in table compare, like you said. Can you provide me guidelines on how to do that?
    Thanks in advance.

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,949

    Default

    Hello,

    I'm unsure how to help with the XML to CSV conversion command line utility, but you can define a new File Format in the Tools menu -> File Formats dialog, New: Table format. This format, in the Conversion tab, can accept any command line utility that takes a source %s input, and exports a temporary text %t output. The %t file is the file we would open in the comparison view. It would run once for each side, so the intended conversion in this case would be a source .xml and outputs a temporary .csv file. The format mask can be assigned as *.xml. When launching the Table compare, and opening an .xml file, it would open with this format and perform the conversion in the background.
    We have a sample KB article discussing this with RESX files in the Text Compare, here:
    http://www.scootersoftware.com/suppo...rnalconversion

    The Table Compare's Session menu -> Session Settings, Columns tab, contains cells for each column of each file. You can Edit a column pair and set a Numeric tolerance. Or, Edit Defaults to add a Numeric tolerance for any Numeric columns. Note, the column must contain only numbers to be detected as Numeric. Session Settings can be saved in that specific View, updated for a parent Folder Compare session, or set as a new default for all future Table Compare sessions.
    Aaron P Scooter Software

  5. #5
    Join Date
    Feb 2016
    Posts
    4

    Default

    OK. I'll try and then report here.
    Thanks!

  6. #6
    Join Date
    Feb 2016
    Posts
    4

    Default

    Hello Aaron,
    I wrote a simple bat file to convert xml into csv, using xml starlet utility. I used this script in conversion tab, and then added a numeric tolerance, like you suggested. I have not fully tested it yet, but seems to work correctly.
    Thanks!

Tags for this Thread

Posting Permissions

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