Announcement

Collapse
No announcement yet.

Ignore certain nodes while comparing XML based on criteria

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

  • Ignore certain nodes while comparing XML based on criteria

    I run comparison script everyday to compare XML Files. There are certain section that I want to remove from comparison like this entire node where ID ends with 123

    Script

    set YYYYMMDD=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
    cd\Program Files\Beyond Compare 4
    BCompare.exe @"E:\Testing\diff.txt" "C:\A_%YYYYMMDD%*_xml" "E:\A_%YYYYMMDD%*.xml" /fv="XML" "E:\Differences.txt"

    XML Sample
    <Header>
    <FileID>
    A_20190722012020
    </FileID>
    <RecordCount>
    200
    </RecordCount>
    </Header>
    <ITEMS ProcessDate="20190722">
    <ITEM>
    <AccountNumber>
    CUST
    </AccountNumber>
    </Entity>
    <Custodian/>
    <Code/>
    <RegistrationCode/>
    <ResponsibilityCode/>
    <RestrictionCode/>
    <ID>
    000307123
    </ID>
    </ITEM>
    </ITEMS>

    Thanks,

  • #2
    Hello,

    You would need to define a grammar element that matches on the concept you need to remove. We have an example case and video here:
    http://www.scootersoftware.com/suppo..._unimportantv3

    To ignore a numeric line that ends with 123, you could use a RegEx:
    \d+123$

    \d+ matches on one or more digits before 123
    123 is the literal for 123
    $ is the end of the line, where 123 is immediately before end of line.
    Aaron P Scooter Software

    Comment

    Working...
    X